Friday, April 17, 2020

C++ program swapping of two variables using 3rd variable

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



No comments:

Post a Comment

Maximum No

//Find the Maximum No between Three Nos' int i=10,o=20,k=30; if(i>o &&i>k) { cout<<"1st is g\n";...