Friday, 10 January 2014

Swap Two Number

Swap Two Number

Swap two number program is nothing just exchange their values.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
textcolor(RED);
gotoxy(25,18);
cprintf("enter valu of a = ");
scanf("\n%d",&a);
gotoxy(25,20);
textcolor(2);
cprintf("enter valu of b = ");
scanf("\n%d",&b);
a=a+b;
b=a-b;
a=a-b;
gotoxy(25,24);
cprintf("a= %d b= %d",a,b);
getch();
}

Output

Swap Two Number

No comments:

Post a Comment