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


Please Help Members By Posting Answers For Below Questions

What is regex used for?

535


Explain the private field modifier?

602


What is jdbc api?

527


What does pointer mean?

537


What is the default size of arraylist in java?

494






Explain scope or life time of local variables in java?

551


What are basic keywords?

549


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread

588


List implementations of list interface?

555


What is the use of System class?

598


What is an interface in java? Explain

565


what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????

1794


What is a condition in programming?

546


What is a parameter example?

518


what is meant by HQL?

637