Monday 8 June 2015

4.Aim - WAP To Swap Two Numbers Without Using Third Variable
Code –

#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b;
 clrscr();
 printf("Enter The Value Of a and b respectively : ");
 scanf ("%d%d",&a,&b);
 a=a+b;
 b=a-b;
 a=a-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