Math, asked by srishtituri09, 1 month ago

write a program in java unit to input values of two variables using scanner class.exchange the values of the variables before exchange qnd after exchange without using 3rd variable​

Answers

Answered by arnimaanuragmishra
1

Answer:

X= 25 (First number), Y= 23 (second number)

Swapping Logic:

X = X + Y = 25 +23 = 48

Y = X - Y = 48 - 23 = 25

X = X -Y = 48 - 25 = 23

and the numbers are swapped as X =23

Similar questions