write a program to swap Two numbers without using temp variable.
Answer Posted / amit chauhan
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("\n Enter the 2 numbers");
scanf("%d%d",&a,&b);
//swaping of 2 numbers without using temp variable
a=a+b;
b=a-b;
a=a-b;
/* or
a=a*b;
b=a/b;
a=a/b;
*/
printf("\n A = %d \n B = %d\n");
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain 'bus error'?
What is conio h in c?
Why calloc is better than malloc?
How can I manipulate individual bits?
What is && in c programming?
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
What is dynamic variable in c?
What is function and its example?
What is the difference between arrays and pointers?
Can you define which header file to include at compile time?
What are extern variables in c?
how to find binary of number?
Explain can static variables be declared in a header file?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
write a program to find out prime number using sieve case?