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 meant by gets in c?
Write a factorial program using C.
What are the advantages of union?
What does it mean when the linker says that _end is undefined?
What does void main () mean?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
Which is best linux os?
What are the differences between Structures and Arrays?
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
What is extern c used for?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
Do string constants represent numerical values?
Explain modulus operator. What are the restrictions of a modulus operator?
What are structural members?
Explain what is #line used for?