010. Write a program to accept two values a & b and interchange their values in C language

#include<stdio.h>
#include<conio.h> 
main()
{
 int a, b, temp;
 clrscr();
 printf("Enter Numbers: ");
 scanf("%d%d",&a,&b);
 printf("\nBefore Swapping..\na=%d,b=%d",a,b); 
 temp=a;
 a=b;
 b=temp;
 printf("\nAfter Swapping..\na=%d,b=%d",a,b);
 getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *