C Program to swap two numbers

Simple C program to swap two numbers.
#include<stdio.h>
int main()
{
 int a,b,temp;
 printf("Enter first number: ");
 scanf("%d",&a);
 printf("Enter second number: ");
 scanf("%d",&b);
 printf("Numbers beofre swapping\n");
 printf("a = %d\nb = %d\n",a,b);
 temp=a;
 a=b;
 b=temp; 
 printf("Numbers after swapping\n");
 printf("a = %d\nb = %d",a,b);
 return 0;
}

Popular posts from this blog