VF编程题请教高手

来源:百度知道 编辑:UC知道 时间:2024/06/18 01:34:45
1.在若干个数学生中,每人考5门功课,从键盘输入一个学生的5门成绩,然后计算并输出该学生的平均成绩。要求程序接受并处理多个学生的成绩。学生人数事先是不确定的,由用户从键盘输入。
2.有一堆核桃,每次往外拿2个,最后还剩下一个单的,如果每次往外边拿3个、4个、5个、6个,都是剩下一个单的,请问这堆核桃最少有多少个?

1.clear
input "请输入学生数" to n
dimen a(5)
m=1

s=0
do while m<=n
?"这是第"+allt(str(m,2))+"个学生"
for i8=1 to 5

input "输入成绩:" to a(i)
s=s+a(i)
endfor
m=m+1
?"此学生的平均成绩为",s/5
enddo

2.
i=7
do while .t.
if i%2=1 and i%3=1 and i%3=1 and i%4=1 and i%5=1 and i%6=1
?"这堆核桃最少有:",i
exit
endif
i=i+1
enddo