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

What does stand for?

599


Is c is a middle level language?

598


Why is it important to memset a variable, immediately after allocating memory to it ?

1556


What is %s and %d in c?

594


Explain a pre-processor and its advantages.

634






Do you know pointer in c?

594


What is console in c language?

611


How can I find the modification date and time of a file?

605


What is a void pointer in c?

609


Tell me with an example the self-referential structure?

567


given post order,in order construct the corresponding binary tree

2324


What is a string?

667


Explain what will the preprocessor do for a program?

606


What are c header files?

582


What is use of null pointer in c?

572