Write a C++ program to swap the values of two numbers using if else statement

Write a C++ program to swap the values of two number if values of both variables are not the same using if-else statement

e.g

before swapping a=5; b=6

after swapping a=6, b=5

logic of swaping program

Flowchart of the program to swap the values of two number using if-else statement

Flowchart of the program to swap the values of two number

C++ Source code of swapping the values of two variables by the using the if-else statement

Output

enter two numbers

3

4

After swapping the values, Value of a is: 4 and Value of b is:3

SFT (Shamil’s Flow Table )

Are you interested to Read about SFT(Shamil’s Flow Table)?

Explanation of swapping  C++ program

 

Latest posts by Prof. Fazal Rehman Shamil (see all)

Buy advertisement space on T4Tutorials

For more details email [email protected]