Swap Two Numbers: In 5 Different Ways
Program to swap two numbers
Input:
Enter the value of X and Y
num1=10
num2=20
Before swapping: 10 20
Output:
num1=20
num2=10
After swapping: 20 10
Solution:
Language Used: Java
Approach 1: swap two numbers using the third variable
import java...
navnathjadhav.hashnode.dev3 min read