This is a simple program to swap the values using third variable.
//This is a program to interchange vaules of to number using thrid variable
#include<stdio.h>
int main()
{
int fst_num,snd_num,trd_num;
printf("Enter the frist number ");
scanf("%d",&fst_num);
printf("\nEnter the scond number ");
scanf("%d",&snd_num);
trd_num=fst_num;
fst_num=snd_num;
snd_num=trd_num;
printf("\nThe interchanged values are\nThe frist number is %d\nThe scond number is %d\n",fst_num,snd_num);
return 0;
}
The output of this program will be.....
//This is a program to interchange vaules of to number using thrid variable
#include<stdio.h>
int main()
{
int fst_num,snd_num,trd_num;
printf("Enter the frist number ");
scanf("%d",&fst_num);
printf("\nEnter the scond number ");
scanf("%d",&snd_num);
trd_num=fst_num;
fst_num=snd_num;
snd_num=trd_num;
printf("\nThe interchanged values are\nThe frist number is %d\nThe scond number is %d\n",fst_num,snd_num);
return 0;
}
The output of this program will be.....
super...your logic i good
ReplyDelete