Monday, November 29, 2010

how write a program to swaping any two number without using 3rd variable ?

#include<stdio.h>
#include<conio.h>

void main()

{

int a,b;
clrscr();

printf("\n\t Enter the any value of A \t:\t");
scanf("%d",&a);
printf("\n\t Enter the any value of B \t:\t");
scanf("%d",&b);
a=a+b;
b=a-b;
a=a-b;
printf("\n\t After swaping the value of A is\t:\t%d",a);
printf("\n\t After swaping the value of B is\t:\t%d",b);
getch();

}

No comments:

Post a Comment