问题补充:
求VB编程:任意输入10个数,求奇数的个数,偶数的和,以及最后一个偶数.
答案:
private sub command1_click()
dim a(9),b(),c,d,e,i as integer
for i=0 to 9
a(i)=int(val(inputbox(输入第 & i+1 & 个数:)))
if a(i) mod 2=1 then
c=c+1elsed=d+a(i)
e=e+1redim preserve b(e)
b(e)=a(i)
end iffor i=0 to 9
print a(i),
next iprintprint 奇数的个数为: & c
print 偶数的和为: & d
if e>0 then print 最后一个偶数为: & b(e)
end sub
如果觉得《求VB编程:任意输入10个数 求奇数的个数 偶数的和 以及最后一个偶数.》对你有帮助,请点赞、收藏,并留下你的观点哦!