Learn C ProgrammingLearn ProgrammingPrograms On Arithmetic OperatorsResources

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

By September 18, 2012 February 5th, 2018 2 Comments
#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();
}

2 Comments

Leave a Reply

DEMO01