我有以下公式:
F = X / 1+4+9+16+....+n^2
我怎样才能编写一个QBasic
找到结果的程序F
?
谢谢。
CLS
INPUT "Input the value of n: ", n%
INPUT "The value of X: ", X
denominator% = 0
FOR i% = 1 TO n%
denominator% = denominator% + i% ^ 2
NEXT i%
F = X / denominator%
PRINT "F = "; F
功率倍增器:
DEFDBL A-Z
INPUT "Input the value of n: ", n
INPUT "The value of X: ", X
INPUT "The power: ", p
denominator = 0
FOR i = 1 TO n
denominator = denominator + i ^ p
NEXT
F = X / denominator
PRINT "F = "; F
END