Program to input two numbers and print their values after interchange(Swap) using third value.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c=0;
clrscr();
printf("Enter first number=");
scanf("%d",&a);
printf("Enter second number=");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf(\nFirst number=%d",a);
printf("\nSecond number=%d",b);
getch();
}
OUTPUT

Note:- If any problem in this program please comment and never forget to share.
#include<conio.h>
void main()
{
int a,b,c=0;
clrscr();
printf("Enter first number=");
scanf("%d",&a);
printf("Enter second number=");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf(\nFirst number=%d",a);
printf("\nSecond number=%d",b);
getch();
}
OUTPUT

Note:- If any problem in this program please comment and never forget to share.
Comments
Post a Comment