Follow Us

LightBlog

Breaking

Wednesday, March 1, 2017

Write a c program to swap two numbers ?


Write a c program to swap two numbers ?


#include <stdio.h> 
#include <conio.h>
int main()
{
   int a, b, temp;
   printf("Enter the value of x and y\n");
   scanf("%d%d", &a, &b);

   printf("Before Swapping\nx = %d\ny = %d\n",a,b);

   temp = a;
   a   = b;
   b   = temp;

   printf("After Swapping\nx = %d\ny = %d\n",a,b);

   return 0;
}

No comments:

Post a Comment