C++ program for swapping using third variable.

#include<iostream.h>
#include<conio.h>
void main(){
float a,b,c;
clrscr();
cout<<"Enter Two Numbers"<<endl;       
cin>>a,b;
cout<<"Before Swapping-"<<endl<<"a= "<<a<<" and b= "<<b<<endl;
c=a;
a=b;
b=c;
cout<<"After Swapping-"<<endl<<"a= "<<a<<" and b= "<<b<<endl;           
getch();
}

No comments:

Post a Comment