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

#!/usr/bin/perl
print "Enter Values for a & b\n";
my ($a,$b);
$a=<STDIN>;
$b=<STDIN>;
print "Value of A & B Befor Swap\n";
print "Value of a = $a\n";
print "Value of b = $b\n";
$b=($a+$b)-($a=$b);
print "Value of A & B After Swaping\n";
print "Value of a = $a\n";
print "Value of b = $b\n";

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are global variables?

1177


What does p mean in physics?

1034


What are the c keywords?

1203


What the different types of arrays in c?

1058


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

2128


What's a good way to check for "close enough" floating-point equality?

1155


Can you write the function prototype, definition and mention the other requirements.

1127


Explain the difference between null pointer and void pointer.

1077


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

1169


What are different storage class specifiers in c?

1087


A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM

2121


Why does this code crash?

1085


what is the difference between 123 and 0123 in c?

1201


What is a structure member in c?

995


Can a pointer be volatile in c?

981