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 do you generate random numbers in C?

1246


What are comments and how do you insert it in a C program?

1302


What is realloc in c?

1166


Write a program to reverse a string.

1144


What is the difference between if else and switchstatement

2003


What is extern keyword in c?

1184


Why does notstrcat(string, "!");Work?

1205


When should the volatile modifier be used?

1232


In C language, a variable name cannot contain?

1325


What does the c in ctime mean?

1159


How can I find the modification date of a file?

1337


Why n++ execute faster than n+1 ?

3146


What is the difference between ++a and a++?

1272


Explain how can I read and write comma-delimited text?

1227


What do you mean by a sequential access file?

1134