Swap Two Numbers using Temporary Variable
You are given two integers A and B. Swap their values using a temporary variable.
Note: You only need to swap values, the printing of values will be taken care of.
Example 1:
Input: A = 5, B = 10
Output:
10
5
Explanation: After swap the value of A will be equal to 10.
After swap value of B will be equal to 5.
Example 2:
Input: A = -25, B = 9
Output:
9
-25
Explanation: After swap the value of A will be equal to 9.
After swap value of B will be equal to -25.
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- −100 ≤ A, B ≤ 100