Monday 20 March 2017

Swap the values of two Variables using three variables

/*    Swap the values of two Variables using three variables    */

#include
int main()
{
 int p;
 int q;
 int r;
 clrscr();

 printf("Enter your value of P : ");
 scanf("%i",&p);

 printf("\n Enter your value of Q : ");
 scanf("%i",&q);

r=p;
p=q;
q=r;

 printf("P : %i",p);
 printf("\nQ : %i",q);

 getch();
 return 0;
}

Output:



No comments:

Post a Comment