Write a program in QBasic to print natural numbers from 1 to 20 in reverse order.
Answers
Answered by
1
Answer:
CLS INPUT "Enter a Number: ", n temp = n num = 0 WHILE temp > 0 r = temp MOD 10 num = num * 10 + r ' Note: We are using '\' for division instead of '/' ' '\' returns integer number ' whereas '/' returns floating number temp = temp \ 10 WEND PRINT "Reverse of"; n; "is: "; num END
Similar questions