> 其他 >
用VF编写程序,完成计算n个数的平均值.
人气:214 ℃ 时间:2020-06-16 13:46:07
解答
n=" "
@ 2,10 say "计算n个数的平均值,先输入数值个数n" get n picture"999999"
read
n=val(n)
DIMENSION x(n)
store 0 to x
s=0
for i = 1 to n
@4,20 say "输入第"+alltrim(str(i))+"个数值" get x(i) picture"999999"
read
s=s+x(i)
endfor
A=s/n
@4,20 say ""+alltrim(str(n))+"个数值的平均值为" +str(A,10,4)
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版