How to swap two numbers (2 variables) without using third variable. 
//Interview question
#input:
num1=50;
num2=100;

#core logic
num1 = num1 + num2;
num2 = num1 - num2;
num1 = num1 - num2;

#output
num1 is 100
num2 is 50



Comments
Comments are not available for this entry.
2024 By Angel Cool