Swapping two numbers without a temporary variable
'‘**************************************************************************
‘Swapping any two numbers without a temporary variable
'‘**************************************************************************
Dim Num1
Dim Num2
Num1=InputBox ("Enter Num1")
Num2=InputBox ("Enter Num2")
Print (" Before Swapping Num1 Value:" & Num1)
Print (" Before Swapping Num2 Value:" & Num2)
Num1=Num1-Num2
Num2=Num1+Num2
Num1=Num2-Num1
Print (" After Swapping Num1 Value:" & Num1)
Print (" After Swapping Num2 Value:" & Num2)
Results window
0 comments:
Post a Comment