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...

write a program to swap Two numbers without using temp variable.

Answer Posted / ratna

#include<stdio.h>
main()
{
int x,y;
printf("\n enter the two numbers:\n");
scanf("%d%d",&x,&y);
y=(x+y)-y;
x=(x+y)-x;
printf("\n x=%d \n y=%d\n");
getch();
}
output: enter the two numbers:10
20
execute the conditions y=30-20=10
x=30-10=20
finally display the output:20 10

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If you know then define #pragma?

1111


What are called c variables?

1069


What's a good way to check for "close enough" floating-point equality?

1168


What is this pointer in c plus plus?

1095


Define circular linked list.

1037


can we implement multi-threads in c.

1134


How can I do graphics in c?

1036


What does 2n 4c mean?

1236


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

1071


How can you increase the allowable number of simultaneously open files?

1164


What are multibyte characters?

1135


What is the difference between union and anonymous union?

1312


What are inbuilt functions in c?

1038


What is the value of h?

1044


What are identifiers c?

1093