Computer Science, asked by arnoygayen, 3 months ago

Swap 2 numbers by using 3rd variable in Qbasic.
Don't write rubbish
if you can't answer then don't.​

Answers

Answered by anindyaadhikari13
1

Question:-

Write a program in QBASIC to swap 2 numbers ny using 3rd variable.

Program:-

This is the required program in QBASIC.

CLS

INPUT "ENTER A: ";A

INPUT "ENTER B: ";B

PRINT "BEFORE SWAPPING, "

PRINT "A: "+A

PRINT "B: "+B

C=A

A=B

B=C

PRINT "AFTER SWAPPING, "

PRINT "A: "+A

PRINT "B: "+B

END

Example:-

a=2

b=3

Now,

c=a=2 >> c=2

a=b=3 >> a=3

b=c=2 >> b=2

Hence, a=3 and b=2 after swapping.

Similar questions