Tuesday 29 August 2017

C program for Swapping two numbers

/*Swap the values of two Variables using three variables*/

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

No comments:

Post a Comment