C++ Program to swap two numbers using temporary variable [DEVCPP/GCC]


//Program to swap two numbers using temporary variable

#include<iostream>

using namespace std;

int main()
{

int a,b,temp;

cout<<"ENTER THE VALUE OF a:";
cin>>a;
cout<<"ENTER THE VALUE OF b:";
cin>>b;
cout<<"BEFORE SWAPPING:"<<endl<<"a="<<a<<" "<<"b="<<b<<endl;

temp=a;
a=b;
b=temp;

cout<<"AFTER SWAPPING:"<<endl<<"a="<<a<<" "<<"b="<<b<<endl;
       return 0;

}



Share this

Related Posts

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer

FIND US ON FACEBOOK!