Monday, 7 January 2013

Swaping two numbers in c code


#include <stdio.h>

int main()
{
   int x, y, swap;

   printf("Enter 1st value : ");
   scanf("%d", &x);
  printf("Enter 2nd value : ");
   scanf("%d", &y);
   printf("Before Swapping\nx = %d\ny = %d\n",x,y);

   swap = x;
   x = y;
   y = swap;

   printf("After Swapping\nx = %d\ny = %d\n",x,y);
   printf("thankyou for visiting in cheema soft \n");
   getch();
}

No comments:

Post a Comment