Write a program in Qbasic. The problem is Use a for/Next loop to total the numbers from 1 to 100. Print the numbers on screen.
The Pseudocode given is:10.12:
Pseudo code:
1. Initialize variables (PrevTotal, Total, LineCt, PageCt, print images, maxlines)
2.Print headings - title, page number, 3 column heads for:
3.1. list of numbers
3.2. plus (previous running total)
3.3. equals this line's total
Formulas:
FOR Count = 1 TO 100
GOSUB CalculateSubtotal 'Keep running subtotals
PRINT USING D1$; Count; PrevTot; Total
LET LineCt = LineCt + 1
IF LineCt >= MaxLines THEN
LET Wt$ = INPUT$(1) 'Wait for a keypress
GOSUB PrintHeadings
END IF
NEXT Count
CalculateSubtotal:
PrevTot = Total
Total = Total + Count