write a program to swap Two numbers without using temp variable.
Answer Posted / insane programmer
#include<stdio.h>
#include<conio.h>
void main()
{
int a=100, b=30;
clrscr();
a = a+b;
b = a-b;
a = a-b;
printf("Swapping without using third variable (using + and -).\n\n");
printf("Value of a=%d and b=%d.", a,b);
getch();
}
you can get more example here http://rajkishor09.hubpages.com/_eknow/hub/How-to-swap-two-numbers-without-using-third-temp-variable
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How can I use a preprocessorif expression to ?
what is the format specifier for printing a pointer value?
Write a code of a general series where the next element is the sum of last k terms.
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
What is .obj file in c?
How do you do dynamic memory allocation in C applications?
What is a rvalue?
What does void main () mean?
How can I sort a linked list?
What are the primitive data types in c?
What does the c in ctime mean?
Explain what is the advantage of a random access file?
What is the maximum no. of arguments that can be given in a command line in C.?
What is typedf?
What are nested functions in c?