write a program in C to swap two variables
Answer Posted / muzammil
#include <stdio.h>
#include <conio.h>
main()
{
int a,b;
printf("Enter the values: ");
scanf("%d%d",&a,&b);
printf("The values before swapping: %d %d",a,b);
a=a-(b=(-b+(a=a+b)));
printf("The values after swapping are: %d %d",a,b);
getch();
}
| Is This Answer Correct ? | 14 Yes | 3 No |
Post New Answer View All Answers
What is difference between Structure and Unions?
Are the variables argc and argv are local to main?
How can I prevent another program from modifying part of a file that I am modifying?
Give me the code of in-order recursive and non-recursive.
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
Explain void pointer?
What functions are used for dynamic memory allocation in c language?
write a programming in c to find the sum of all elements in an array through function.
Is there a built-in function in C that can be used for sorting data?
Can a variable be both const and volatile?
What is meant by gets in c?
Is exit(status) truly equivalent to returning the same status from main?
What is bin sh c?
What is #include stdlib h?
How can I access an I o board directly?