Write QBASIC program to print numbers between 50 and 15 with a decreasing step of 5.
Answers
Answered by
2
Language:
QBasic
Program:
cls
for i = 50 to 15 step -15
print(i)
next i
end
Output:
50
45
40
35
30
25
20
15
Explanation:
- Line 1: Clears screen.
- Line 2: Starts a for loop from 50 to 15 with a step of -5 i.e the loop will run backwards.
- Line 3: prints i every time the loop runs.
- Line 5: Ends line.
Similar questions