• Post Reply Bookmark Topic Watch Topic
  • New Topic

algorithm for addition using only bitwise operators  RSS feed

 
T Chakradhar Reddy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What is the basic algorithm so that i can add two integers without using arithmetic operators.
I want to use only bitwise operators to achieve this and i would like to include negative numbers also.
muraaa
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"thirupartha muraaaa,"

Welcome to JavaRanch! Please check your private messages by clicking on My Profile. Thanks!
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks an awful lot like a homework problem. or at the very least, a theoretical exercise you have given yourself. So, it would be pointless at best, and cheating at worst for someone to give you the solution.

So, what have you tried? where are you stuck? what do you think will or won't work, and why?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!