//Swapping of two numbers using third variable.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter the value of a:");
scanf("%d",&a);
printf("Enter the value of b:");
scanf("%d",&b);
printf("After swapping:\n");
c=a;
a=b;
b=c;
printf("a=%d and b=%d",a,b);
getch();
}
Output:
Enter the value of a:52Enter the value of b:32
a=32 and b=52
No comments:
Post a Comment