how to add numbers without using arithmetic operators.

Answers were Sorted based on User's Feedback



how to add numbers without using arithmetic operators...

Answer / dally

#include<stdio.h>
int main()
{
int a=3,b=5;
while(a--)
b = b++;

printf("%d\n");

}

Is This Answer Correct ?    2 Yes 8 No

how to add numbers without using arithmetic operators...

Answer / mobashyr

#include<stdio.h>

int main()
{
int x=5,y=10; //Use scanf otherwise
int z=add(x,y);
return 0;
}

int add(int a,int b)
{
int i;
for(i=0;i<b;i++)
{
a++;
}
return a;
}

Is This Answer Correct ?    0 Yes 6 No

how to add numbers without using arithmetic operators...

Answer / bijoy skaria

use ++ operator

Is This Answer Correct ?    3 Yes 13 No

how to add numbers without using arithmetic operators...

Answer / satish gaikwad

suppose a=6 and b=3

we can write c=a-(-b)
which will give us c=9

Is This Answer Correct ?    5 Yes 23 No

Post New Answer

More C Interview Questions

What are unions in c?

0 Answers  


Heyyy All, Just a challenge . A C program with if Else if(){ /// insert sumthing print ("in if") // insert sumting } else { ///// insert sumthing print ("in else"); //// insert sumthing } can anyone modify it so that program prints. if and else both

3 Answers  


hOW Can I add character in to pointer array of characters char *a="indian"; ie I want to add google after indian in the char *a

1 Answers  


cavium networks written test pattern ..

0 Answers   Cavium Networks,


Why ordinary variable store only one value  

0 Answers  






dynamically allocate memory for linear array of n integers,store some elements in it and find some of them

1 Answers  


Explain the difference between #include "..." And #include <...> In c?

0 Answers  


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

0 Answers   HP,


main() { int i; for(i=0;i<5;i++) printf("%d",1l<<i); } why doesn't 'l' affect the code??????

1 Answers  


write a program to swap two variables a=5 , b= 10 without using third variable

5 Answers  


How can we open a file in Binary mode and Text mode?what is the difference?

1 Answers   PanTerra,


Explain how to reverse singly link list.

0 Answers  


Categories