Calculus Computer Lab
Math 190


News

Lab Schedule

QuickBasic Notes

Fortran Notes

Tutor Room

Winplot Manual

Lab Home

xxxxxxxxxxxxxxxxxx

REM This program adds the p-th powers of the first N positive integers
CLS
DEFINT I, N
DEFDBL P, S
INPUT "Enter a positive integer N : ", N
INPUT "Enter a power p : ", p

I = 1
sum = 0

DO
        sum = sum + I ^ p
        I = I + 1
LOOP WHILE I <= N

PRINT
PRINT "1 ^"; p; "+ 2 ^"; p; "+ ... +"; N; "^"; p; " = "; sum
PRINT : PRINT "Bye"
END