Write a program for swapping of two numbers?

C PROGRAM FOR SWAPPING OF TWO NO.s

              
                                     Best C programming app is Dev c++

PROGRAM:-

#include<stdio.h>
int main()
{
    int a,b,temp;
printf("Enter the value for a:");
scanf("%d",&a);
printf("Enter the value for b:");
scanf("%d",&b);
printf("Before swapping a=%d,b=%d and ",a,b);
temp=a;
a=b;
b=temp;
printf("After swapping a=%d,b=%d",a,b);
return 0;
}

OUTPUT:-

Enter the value for a:45
Enter the value for b:95
Before swapping a=45,b=95 and After swapping a=95,b=45



Thank you all -----

Follow my blog for more programming knowledge...

------------------x----------------------x-------------------------x------------------


Comments

Popular Posts