without using arthematic operation ,how can you write the
logic for adding/substraction/multiplication?
Answer Posted / sankar
Without using arthematic operation adding two numbers:
#include<stdio.h>
int main()
{
int a=5,b=6;
while(b)
{
a=a^b;
b=(a^b)&b;
b=b<<1;
}
printf("The sum of a and b is: %d\n",a);
return 0;
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is the difference between delete and delete[]
What is the purpose of static methods and static variables?
What is string data type?
Can we have a method name same as class name in java?
What do you mean by constant time complexity?
What is the primary benefit of encapsulation?
What are implicit objects in java?
Which is fastest collection in java?
Can we use static class instead of singleton?
What do heavy weight components mean in java programming?
Which list is sorted in java?
What is the java virtual machine?
A person says that he compiled a java class successfully without even having a main method in it? Is it possible?
Give some features of interface?
What is the flag in java?