Monday, May 7, 2018

Write a C program to swap two values without using third variable.


#include<stdio.h>

int main()
{
int a,s;
printf("Enter Two integer : ");
scanf("%d%d",&a,&s);
a=a+s;
s=a-s;
a=a-s;
printf("%d , %d",a,s);
return 0;
}

OUTPUT :

Enter Two integer : 6    9

9    6

0 comments: