write a program to swap Two numbers without using temp variable.
Answer Posted / tamal datta
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("\n Enter a = ");
scanf("%d",&a);
printf("\n Enter b = ");
scanf ("%d",&b);
printf ("\nBefore swapping a = %d",a);
printf ("\nBefore swapping b = %d",b);
//swaping of 2 numbers without using temp variable
a=a+b;
b=a-b;
a=a-b;
printf("\nAfter swapping a = %d",a);
printf ("\nAfter swapping b= %d",b);
getch();
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What are the uses of null pointers?
Write a program to check palindrome number in c programming?
can anyone suggest some site name..where i can get some good data structure puzzles???
How are strings stored in c?
What is the maximum length of an identifier?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
When the macros gets expanded?
Are pointers really faster than arrays?
can we have joblib in a proc ?
Explain b+ tree?
What is a pragma?
What is a nested formula?
How to implement a packet in C
Are enumerations really portable?
Write a program to implement queue.