cls 清屏 input n 输入一个人数 he=0 累加问题初始化为"0" dim a(n) 定义一个数组 a(n) for i=1 to n 循环 input a(i) 把成绩输入到a(i) he=he+a(i) he=he+成绩 next i 结束循环 pj=he/n 平均=总数/份数 cs=0 cs=0 for i=1 to n 循环 if a(i)>pj then cs=cs+1 如果成绩〉平均那么cs=cs+1 next i 结束循环 pritn pj 打印 平均 print cs 打印高于平均分的人数 end 结束程序
注:只能在qbasic 下使用
|
顶端