programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

# java

Greenhorn
Posts: 1
• Number of slices to send:
Optional 'thank-you' note:
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??

Ranch Hand
Posts: 704
• Number of slices to send:
Optional 'thank-you' note:
Please post your code, so that we can see what is going on.

(instanceof Sidekick)
Posts: 8791
• Number of slices to send:
Optional 'thank-you' note:
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.

Greenhorn
Posts: 21
• Number of slices to send:
Optional 'thank-you' note:
a ton of fun for you maybe I have studied boolean math and yuk - lets not and say we did

 You've gotta fight it! Don't give in! Read this tiny ad: a bit of art, as a gift, that will fit in a stocking https://gardener-gift.com