Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i write a simple C/C++ Program that prints the sum of two integers without using arithmetic Operator i.e. a+b.
Posted
Comments
Richard MacCutchan 1-Feb-14 4:28am    
You can't; it's not a simple problem.
[no name] 1-Feb-14 5:28am    
Google "addition without using +" please.

1 solution

This looks like homework.
Hint is think about using bitwise operators.
 
Share this answer
 
Comments
Shah Parth P 1-Feb-14 4:27am    
Not a Homework.
was just thinking that is it possible or not?
and if yes then how?
Abhinav S 1-Feb-14 4:28am    
Its possible using bit level instructions.
enhzflep 1-Feb-14 4:51am    
The fact that the question is "How can I...", rather than "Can I ..." gives the impression that you've been told it's possible but don't have an idea of how to go about it.

Hint: Look into ALUs - these are the hardware units inside the CPU which perform the steps required to implement the add and sub (and other arithmetic) instructions.
Arithmetic logic unit (ALU) - wikipedia

Particularly, look into the adder circuit. (3rd link of the 'See also' section)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900