C program to swap two numbers

#include< stdio.h >
 #include< conio.h >
 void main ()
{
 int p, q, swap;
 clrscr();
 printf("Enter two numbers:");
 scanf("%d\t %d",&a,&b);
 swap=p; p=q; q=swap;
 printf("After swapping the values are p=%d and q=%d",p,q);
 getch();
 }
 }

OUTPUT :

Enter two numbers :5 8
After swapping the values are p=8 and q=5

No comments :

Post a Comment