News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

Addition two numbers without using arithmatic operators

Started by aruljothi, Sep 21, 2008, 09:56 AM

Previous topic - Next topic

aruljothi

#include<stdio.h>
int main()
{
int a=3,b=5;
int d=add(a,b);
printf("%d",d);
}
int add(int a,int b){
int c;
        while( b ){
             
                c = a&b;
                a ^= b;
                b = c<<1;
        }
   return a;
   }