Saturday, July 20, 2013

Swap two Variables in C Program

Swap the values of two Variables using three variables 

#include<stdio.h>
int main()
{
 int a,b,c;
  printf("Type value of A : ");
 scanf("%d",&a);
 printf("\nType value of b : ");
 scanf("%d",&b);
 c=a;
 a=b;
 b=c;
 printf("a : %d",a);
 printf("\nb : %d",b);
 return 0;
}

No comments:

Post a Comment