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 / romeld

#include<stdio.h>
main()
{
int a,b;
printf("enter the value of a and b\n");
scanf("%d%d",&a,&b);
printf("before swapping\na=%d\nb=%d\n",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("after swapping\na=%d\nb=%d\n",a,b);
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you convert integers to binary or hexadecimal?

1037


What does return 1 means in c?

1073


Is int a keyword in c?

984


Are pointers integers in c?

1077


What is a sequential access file?

1178


In which header file is the null macro defined?

1346


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1985


Explain goto?

1158


What is difference between array and structure in c?

1192


Difference between pass by reference and pass by value?

1160


What is use of bit field?

1304


How do you determine whether to use a stream function or a low-level function?

1126


Explain what is the concatenation operator?

1174


What is the use of pragma in embedded c?

1060


What are pointers in C? Give an example where to illustrate their significance.

1227