C program to swap value of two variables using third variable.
#include<stdio.h>
#include<conio.h>
void main(){
float a,b,c;
clrscr();
printf("enter two values\n");
scanf("%f%f",&a,&b);
printf ("before swapping a=%f and b=%f",a,b);
c=a;
a=b;
b=c;
printf("after swapping a=%f and b=%f",a,b);
getch();
}
#include<conio.h>
void main(){
float a,b,c;
clrscr();
printf("enter two values\n");
scanf("%f%f",&a,&b);
printf ("before swapping a=%f and b=%f",a,b);
c=a;
a=b;
b=c;
printf("after swapping a=%f and b=%f",a,b);
getch();
}
Comments
Post a Comment