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 temporary
variable?

Answer Posted / guest

[code]

main()
{
int a=10;
int b=20;
printf("a = %d\nb = %d\n",a,b);
a =a+b; b=a-b; a=a-b; // This is first way.

a =a*b; b=a/b; a=a/b;
printf("a = %d\nb = %d\n",a,b);
}
[/code]

[code]
main()
{
int a=10;
int b=20;
printf("a = %d\nb = %d\n",a,b);
a =a*b; b=a/b; a=a/b; //This is second way
printf("a = %d\nb = %d\n",a,b);
}
[/code]




Is This Answer Correct ?    19 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of c language?

974


What are the features of the c language?

1035


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

2581


A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor

1036


What are the salient features of c languages?

1042


How can you tell whether a program was compiled using c versus c++?

1043


What is this pointer in c plus plus?

1023


Can we assign string to char pointer?

1040


Can you define which header file to include at compile time?

980


Explain bit masking in c?

1079


Are enumerations really portable?

976


Why should I use standard library functions instead of writing my own?

1204


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

960


How can you return multiple values from a function?

1050


What is a buffer in c?

945