Code In Tech - The Ultimate World of Computer Technology

Sunday, 22 April 2012

C program for swap two values without using any other value

SOURCE CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b;
 clrscr();
 printf("enter value for a :");
 scanf("%d",&a);
 printf("enter value for b :");
 scanf("%d",&b);

 a=a+b;
 b=a-b;
 a=a-b;
 printf("swaped value of a=%d & b=%d",a,b);
 getch();
}

No comments :

Post a Comment