Program to swap the value of two variables.

A program that get two numbers from the users and swaps the values and display.c program to swap two numbers



using namespace std;
#include<iostream>
#include<conio.h>
int main()
{
int x,y,temp;
cout<<"Enter value of x:";
cin>>x;
cout<<"Enter value of y:";
cin>>y;
cout<<"You input\n x="<<x<<"\n y="                              <<y<<endl;
temp=x;
x=y;
y=temp;
cout<<"Values after swaping\n x="<<x<<"\n y="<<y;
getch();
return 0;
}
Program to swap the value of two variables. Program to swap the value of two variables. Reviewed by Shoaib Jameel on 3/06/2017 03:12:00 pm Rating: 5

No comments:

Advertisment

Theme images by mariusFM77. Powered by Blogger.