Monday, 8 June 2015

5.Aim - WAP To Swap Two Numbers Using Third Variable
Code-

#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,c;
 clrscr();
 printf("Enter The Value Of a and b respectively : ");
 scanf ("%d%d",&a,&b);
 c=a+b;
 b=c-b;
 a=c-b;
 printf("\nThe Values Of a and b After Swapping is %d %d",a,b);
 getch();
}

OUTPUT
Enter The Values Of a and b respectively : 35  93
The Values Of a and b After Swapping is 93 & 35






No comments:

Post a Comment