how to add numbers without using arithmetic operators.
Answer Posted / sneha
#include <stdio.h>
int add(int a,int b)
{
if(!a)
return b;
else
return add((a&b)<<1,a^b);
}
void main()
{
int a=2, b=3, c;
c = add(a,b);
printf("%d\n",c);
}
Is This Answer Correct ? | 15 Yes | 3 No |
Post New Answer View All Answers
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
Which is the memory area not included in C program? give the reason
What are the advantages of using linked list for tree construction?
What is the usage of the pointer in c?
using only #include
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
What is the difference between array_name and &array_name?
Where is volatile variable stored?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
What are the three constants used in c?
Is main is a keyword in c?
Write a program to reverse a given number in c language?
What are the different types of errors?
What is extern keyword in c?
Which function in C can be used to append a string to another string?