Pages

Friday, 18 May 2012

Exchange to value without use third variable


7./*Write a program to Exchange  to value without use third variable*/

#include<stdio.h>
#include<conio.h>
main()
{
int a,b;
clrscr();
printf("\n ENTER VALUE A:-");
scanf("%d",&a);
printf("\n ENTER VALUE B:-");
scanf("%d",&b);
a=a+b;
b=a-b;
a=a-b;
printf("\n a=%d,b=%d",a,b);
getch();
}


OUTPUT
            ENTER VALUE A:10
            ENTER VALUE B:15
            A=15,B=10

No comments:

Post a Comment