[algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread Brijesh
How to add two nos without using any operator...? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/MpNKzlE3UuwJ. To post to this group, send email to

Re: [algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread Gaurav Menghani
I guess you mean without using any 'arithmetic operator'. If yes, it can be done with XOR and AND operators. Not sure how it can be done otherwise, without using any kind of operators AT ALL. On Sun, Aug 28, 2011 at 12:37 AM, Brijesh brijeshupadhyay...@gmail.com wrote: How to add two nos

Re: [algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread sagar pareek
yeah one option is half adder with xor and and operators one more solution http://www.ideone.com/B07bn On Sun, Aug 28, 2011 at 12:41 AM, Gaurav Menghani gaurav.mengh...@gmail.com wrote: I guess you mean without using any 'arithmetic operator'. If yes, it can be done with XOR and AND

Re: [algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread Mohit kumar lal
int add(int a, int b) { if (!a) return b; else return add((a b) 1, a ^ b); } On Sun, Aug 28, 2011 at 12:54 AM, sagar pareek sagarpar...@gmail.comwrote: yeah one option is half adder with xor and and operators one more solution

Re: [algogeeks] Adding Two no without using any operator...??

2011-08-27 Thread tech coder
int add(int a,int b) { int sum=a^b; int carry=ab; while(carry!=0) { carry=1; a=sum; b=carry; sum=a^b; carry=ab; } return sum; } On Sat, Aug 27, 2011 at 12:28 PM, Mohit kumar lal kumarmohit...@gmail.comwrote: int add(int a,