How to add two numbers without using arithmetic operators?
Answer Posted / srinu
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,i,j,k=0;
printf("enter 2 numbers");
scanf("%d%d",&a,&b);
if(a>b)
{
k=b;
for(i=1;i<=a;i++)
k++;
}
else
{
k=a;
for(j=1;j<=b;j++)
k++;
}
printf("sum of 2 numbers is %d",k);
}
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Explain the advantages of using macro in c language?
Why array is used in c?
When is a void pointer used?
What is modifier & how many types of modifiers available in c?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What is difference between array and pointer in c?
What are register variables in c?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
How can I remove the leading spaces from a string?
Is null a keyword in c?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
Are pointers integers in c?
Why is it that not all header files are declared in every C program?
in iso what are the common technological language?