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

Write a program in C to convert date displayed in gregorian to julian date

0 Answers   HCL, Wipro,


code for concatination of 2 strings with out using library functions?

3 Answers  


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

1 Answers  


What is #line in c?

1 Answers  


What is openmp in c?

1 Answers  


Which is better between malloc and calloc?

1 Answers  


How to write a multi-statement macro?

1 Answers  


wat are the two methods for swapping two numbers without using temp variable??

2 Answers  


how to get the starting address of file stored in harddisk through 'C'program.

2 Answers   Siemens,


Is c is a procedural language?

1 Answers  


What is calloc malloc realloc in c?

1 Answers  


What should not contain a header file?

2 Answers  


Categories