Swapping two numbers
Two numbers can be swapped or interchanged. It means first number will become second and second number will become first.
There are two methods for swapping:
Swapping Using Third Variable
Swap two numbers 45 and 78 using a third variable.
Swapping Without using Third Variable
Swap two numbers without using a third variable is done in two ways:
Example for (+ and -):
Example for (* and /):