Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

difference of two no's with out using - operator

Answer Posted / supri

see subtraction itself is the addition of the number with
its 2's complement....
add(int a,int b)
{
if(!a)
return b;
else
return(add((a&b)<<1,a^b));
}
main()
{
int a,b;
scanf("%d%d",&a,&b);
b=add(~b,1);
printf("%d",add(a,b));
return;
}
u can try this...

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the significance of scope resolution operator?

1456


Discuss the function of conditional operator, size of operator and comma operator with examples.

1212


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4750


Explain a pre-processor and its advantages.

1190


Write a program to show the change in position of a cursor using c

1122


swap 2 numbers without using third variable?

1177


What are extern variables in c?

1036


can we have joblib in a proc ?

2381


What is the difference between #include

and #include “header file”?

1090


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

2747


What is the meaning of typedef struct in c?

1115


Explain logical errors? Compare with syntax errors.

1126


How important is structure in life?

1144


What is the difference between the local variable and global variable in c?

1015


How is a pointer variable declared?

1158