当前位置:编程学习 > VB >>

VB编程问题

1.利用输入窗口输入10个数,求这10个数的最大值。

2.求出个位数为6、能被3整除、且十位数是偶数的三位数共有多少个?(求整数N的十位数方法:(N MOD 100 \ 10))

追问:缺少 end sub

答案:1.
sub main()
    dim i as integer,max as integer,c as integer;
    i=1
    max=cint(inputbox("输入第“ & i & “个数”,"输入","0"));
    while i<=10
        i=i+1
        c=cint(inputbox("输入第“ & i & “个数”,"输入","0"));
        if max<c then
           max=c
        end if
    wend
    msgbox "max is " & max
end sub
2.
sub main()
    dim i as integer,count as integer
    count=0
    for i=106 to 986 step 10
         if (i mod 10)=6 and ((i mod 100)\10) mod 2=0 and i mod 3=0 then
                count=count+1
        end if
   next
   msgbox "the number is " & count
 
end sub

上一个:VB编程问题
下一个:VB编程问题

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,