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 in C to swap two variables

Answer Posted / muzammil

#include <stdio.h>
#include <conio.h>

main()
{
int a,b;
printf("Enter the values: ");
scanf("%d%d",&a,&b);
printf("The values before swapping: %d %d",a,b);
a=a-(b=(-b+(a=a+b)));
printf("The values after swapping are: %d %d",a,b);
getch();
}

Is This Answer Correct ?    14 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between Structure and Unions?

1249


Are the variables argc and argv are local to main?

1315


How can I prevent another program from modifying part of a file that I am modifying?

1051


Give me the code of in-order recursive and non-recursive.

1368


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

2128


Explain void pointer?

1039


What functions are used for dynamic memory allocation in c language?

1145


write a programming in c to find the sum of all elements in an array through function.

2168


Is there a built-in function in C that can be used for sorting data?

1250


Can a variable be both const and volatile?

1128


What is meant by gets in c?

1178


Is exit(status) truly equivalent to returning the same status from main?

1068


What is bin sh c?

1026


What is #include stdlib h?

1103


How can I access an I o board directly?

1089