| Author |
java
|
Sreeram Rajesh
Greenhorn
Joined: Mar 17, 2005
Posts: 1
|
|
|
i want to add two numbers without using addition operator.i have tried my hand in solving the problem by using bitwise operators.but the solution worked for few numbers and when i tried the same code for different input i failed to achieve the result.could u help me in this regard??
|
 |
Nigel Browne
Ranch Hand
Joined: May 15, 2001
Posts: 673
|
|
|
Please post your code, so that we can see what is going on.
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
Have you ever studied Boolean Algebra? You could get the bit patterns for two numbers and add them the hard way, just like the CPU does. See if this makes any sense at all: http://thalia.spec.gmu.edu/~pparis/classes/notes_101/node109.html Frankly, this sounds like a ton of fun to implement ... make HalfAdder and FullAdder objects, chain them together. Extremely geeky.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
Rene Smith
Greenhorn
Joined: Jun 10, 2004
Posts: 21
|
|
a ton of fun for you maybe I have studied boolean math and yuk - lets not and say we did
|
 |
 |
|
|
subject: java
|
|
|