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...

swap two integer variables without using a third temporary
variable?

Answer Posted / sidhartha

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("\n ENTER 2 VALUES : ");
scanf("%d%d",&a,&b);
printf("\n THE VALUES BEFORE SORTING : %d,%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("\n THE VALUES AFTER SORTING : %d,%d",a,b);
getch();
}

Is This Answer Correct ?    40 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a pointer value and address in c?

1120


Explain how do you sort filenames in a directory?

1031


What is the correct declaration of main?

1206


Explain how can I pad a string to a known length?

1189


Why does the call char scanf work?

1200


How to establish connection with oracle database software from c language?

2194


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

2256


Why is %d used in c?

1005


Describe the order of precedence with regards to operators in C.

1047


what is different between auto and local static? why should we use local static?

1122


write a program fibonacci series and palindrome program in c

1036


What is a program?

1250


What is structure in c language?

1163


Explain what are the different file extensions involved when programming in c?

1107


What is the purpose of the preprocessor directive error?

1262