write a program to swap Two numbers without using temp variable.
Answer Posted / harisharumalla
#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 ? | 604 Yes | 119 No |
Post New Answer View All Answers
How can I find the modification date of a file?
Explain how do you override a defined macro?
How can I dynamically allocate arrays?
write a program to print data of 5 five students with structures?
What is typedef?
What is variable initialization and why is it important?
Is c easy to learn?
What does c value mean?
Hi can anyone tell what is a start up code?
Is python a c language?
How would you rename a function in C?
What are the key features in c programming language?
What is nested structure with example?
Are there namespaces in c?
Why is not a pointer null after calling free?