CPP
#include <iostream>
Try it Yourself ➠
Swapping using 3rd variable in C++
12 May
0
Write a program (WAP) in C++ to read two numbers from keyboard(User Input) and exchanging the value of two variable(Swapping).
#include <iostream>
using namespace std;
int main()
{
int a,b,temp;
cout<<"Enter two Numbers A & B :\n";
cin>>a>>b;
cout<<"Before Swapping :\nA ="<<a<<"\nB ="<<b<<"\n";
temp = a;
a = b;
b = temp;
cout<<"After Swapping :\nA ="<<a<<"\nB ="<<b<<"\n";
return 0;
}
Try it Yourself ➠
Must Read :-
- Blogger Tutorial
- C Programs
- C++ Programs
- Java Programs
- Python Programs
- Programming Notes
- Questions & Answers
- My Codes : HTML, CSS & JS
- All Subject Notes
Previous article
Next article
Leave Comments
Post a Comment