DO you want to swap Number ?
Then lets do it.....
#include<iostream>
using namespace std;
void main()
{
//Swapping with 3rd Variable
int a=10,b=20,c;
cout<<"Value of 'a' before Swapping: "<<a<<endl;
cout<<"Value of 'b' before Swapping: "<<b<<endl;
c=a; //c=a(10) -> c=10
a=b; //a=b(20) -> a=20
b=c; //b=c(10) -> b=10
cout<<"Value of 'a' after swapping: "<<a<<endl;
cout<<"Value of 'b' after swapping: "<<b<<endl;
system("pause");
}
Video Link for more Help::
https://youtu.be/9PYADBSffQ0
using namespace std;
void main()
{
//Swapping with 3rd Variable
int a=10,b=20,c;
cout<<"Value of 'a' before Swapping: "<<a<<endl;
cout<<"Value of 'b' before Swapping: "<<b<<endl;
c=a; //c=a(10) -> c=10
a=b; //a=b(20) -> a=20
b=c; //b=c(10) -> b=10
cout<<"Value of 'a' after swapping: "<<a<<endl;
cout<<"Value of 'b' after swapping: "<<b<<endl;
system("pause");
}
Video Link for more Help::
https://youtu.be/9PYADBSffQ0

No comments:
Post a Comment