//Write a C++ program to interchange the values of two variables using third variable.
#include<iostream.h>
#include<conio.h>
void main( )
{
int a, b, temp;
clrscr( );
cout<<"Enter the two numbers:\n";
cin>>a>>b;
cout<<"Before Interchanging : a ="<<a<<" and b = "<<b<<endl;
temp = a ;
a = b ;
b = temp ;
cout<<"After Interchanging : a ="<<a<<" and b = "<<b<<endl;
getch();
}
Write a program to interchange the values of two variables using a third variable
Reviewed by Vision Academy
on
February 20, 2022
Rating:

No comments: