Wednesday, July 29, 2020

Write a Program Swap Two Numbers Program in C++.

Swap Two Numbers Program in C++.

#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter value of a:\n";
cin>>a;
cout<<"Enter value of b: ";
cin>>b;
c=a;
a=b;
b=c;
cout<<"After swap a: "<<a<<"b: "<<b;
return 0;
}

OUTPUT

Enter value of a:
28
Enter value of b: 19
After swap a: 19 b: 28

No comments:

Post a Comment

Please do not any spam link in Comment Box