Welcome, %1$s. Please login or register.

September 24, 2017, 05:43:37 PM
: 1
: Addition without + operator  ( 1623 )
« : February 06, 2008, 06:27:52 AM From archu»



Addition without + operator


Add two numbers without using + operator. ???

 
Liked It? Share it!

              


« #1 : February 26, 2008, 11:24:33 PM From spazinvader»

I got one solution for it.

#include<stdio.h>
void main()
{
int a,b,sum;
printf("The two numbers are:");
scanf("%d%d",&a,&b);
sum=a^b;
while(a&b)
{
b=a^b;
b=b<<1;
a=sum;
sum=a^b;
}
printf("The sum is:%d",sum);
}
: 1
« previous next »

 

Best RatedList All>>



Latest
Random



SMF 2.0.10 | SMF © 2015, Simple Machines | Contact Webmaster | OnlineFunDb.com © 2009/10 | Legal Disclaimer