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
What are global variables?
What does p mean in physics?
What are the c keywords?
What the different types of arrays in c?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
What's a good way to check for "close enough" floating-point equality?
Can you write the function prototype, definition and mention the other requirements.
Explain the difference between null pointer and void pointer.
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
What are different storage class specifiers in c?
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
Why does this code crash?
what is the difference between 123 and 0123 in c?
What is a structure member in c?
Can a pointer be volatile in c?