Thursday, July 7, 2011

Swap programs:

Swap1.c

#include

#include

void main()

{

int a,b,t;

clrscr();

printf("enter the value of a\n");

scanf("%d",&a);

printf("enter the value of b\n");

scanf("%d",&b);

t=a;

a=b;

b=t;

printf("the swap elements are :%d\t%d",a,b);

getch();
}


Output:
enter the value of a
3
enter the value of b
5
the swap elements are :5 3

No comments:

Post a Comment