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

Why use int main instead of void main?

1080


What is call by value in c?

963


How can this be legal c?

1057


What should malloc(0) do?

1066


How can I determine whether a machines byte order is big-endian or little-endian?

1018


What are identifiers in c?

1161


How to delete a node from linked list w/o using collectons?

2741


Write a program to know whether the input number is an armstrong number.

1084


What is the use of ?: Operator?

1093


a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if

1104


What are the application of void data type in c?

1149


Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

1106


What are the advantages of c language?

1055


What is s in c?

1012


Is a pointer a kind of array?

1135