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 meant by gets in c?

1103


Write a factorial program using C.

1017


What are the advantages of union?

1023


What does it mean when the linker says that _end is undefined?

1040


What does void main () mean?

1179


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1910


Which is best linux os?

972


What are the differences between Structures and Arrays?

1130


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1051


What is extern c used for?

999


write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a

1885


Do string constants represent numerical values?

1323


Explain modulus operator. What are the restrictions of a modulus operator?

970


What are structural members?

954


Explain what is #line used for?

1011