write a program in C to swap two variables

Answer Posted / senthil mca sns

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter the a value:");
scanf("%d",&a);
printf("Enter the b value:");
scanf("%d",&b);
b=a+b-(a=b);
printf("After Swapping a=%d,b=%d",a,b);
getch();
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

For what purpose null pointer used?

615


What tq means in chat?

601


Why is c still so popular?

625


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2419


How can I prevent another program from modifying part of a file that I am modifying?

622






What is a structure and why it is used?

630


Explain how do you list files in a directory?

626


What is c method?

545


What is the difference between int main and void main?

583


What is function definition in c?

597


What are the features of c languages?

635


What is the purpose of main( ) in c language?

636


Can main () be called recursively?

640


Explain how can type-insensitive macros be created?

581


Explain the advantages and disadvantages of macros.

634