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 / gaurav sharma

#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int a,b;
printf("enter the value of a : ");
scanf("%d",&a);
printf("enter the value of b : ");
scanf("%d",&b);
printf("Before swapping a is %d and b is %d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("\nAfter swapping of a and b:\na=%d\nb=%d",a,b);
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;

1729


What is use of bit field?

1235


what is stack , heap ,code segment,and data segment

2633


What is the scope of static variable in c?

944


Hai what is the different types of versions and their differences

1897


What is the use of f in c?

934


What is scope rule in c?

1014


Are pointers really faster than arrays?

965


What is meant by type casting?

1020


Ow can I insert or delete a line (or record) in the middle of a file?

953


write a c program to find the sum of five entered numbers using an array named number

2076


Explain enumerated types in c language?

991


Define macros.

1223


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2813


What does sizeof function do?

1126