Friday, 9 May 2014

Write a program to swap the values of two variables

Leave a Comment

Solution:-
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
  
    int number1,number2,temp;
    cout<<"Enter Number 1 = ";
    cin>>number1;
    cout<<"Enter Number 2 = ";
    cin>>number2;
    temp=number1;
    number1=number2;
    number2=temp;
    cout<<"After Swaping Number 1 = "<<number1;
    cout<<"\nAfter Swaping Number 2 = "<<number2;
getch();
}


If You Enjoyed This, Take 5 Seconds To Share It