Calculus Computer Lab
Math 190


News

Lab Schedule

QuickBasic Notes

Fortran Notes

Tutor Room

Winplot Manual

Lab Home

xxxxxxxxxxxxxxxxxx

REM This program reads a list of numbers from a file named
REM "addthem.bas", and computes the sum of the numbers.
REM It prints the sum to the screen.
REM As no directory address is given, the file must reside 
REM in the same directory as the Basic program.
CLS

OPEN "addthem.bas" FOR INPUT AS #1
S = 0

DO UNTIL EOF(1)
        INPUT #1, X
        S = S + X
LOOP

CLOSE #1
PRINT "The sum of the numbers in the file is"; S
PRINT : PRINT "Goodbye"
END