关于vb代码怎么编写,vb代码这个很多人还不知道,今天菲菲来为大家解答以上的问题,现在让我们一起来看看吧!

1、Option ExplicitFunction fc(a) As BooleanDim i As LongFor i = 2 To Int(a / 2)If a Mod i = 0 Thenfc = FalseExit ForElsefc = TrueEnd IfNext iEnd FunctionPrivate Sub Form_Click()Dim i, j, k, m, s, g, f As Integerj = 0k = 0f = 0Dim a(1 To 80) As IntegerDim b(1 To 80) As IntegerDim c(1 To 80) As IntegerDim d(1 To 80) As IntegerFor i = 1 To 80a(i) = Int(Rnd() * 100)if a(i)<10 then a(i)=a(i)+10If a(i) Mod 2 = 0 Thenj = j + 1b(j) = a(i)Elsek = k + 1c(k) = a(i)End IfNext iFor i = 1 To jFor m = i + 1 To jIf b(i) < b(m) Thens = b(m)b(m) = b(i)b(i) = sEnd IfNext mNext iFor i = 1 To kFor m = i + 1 To kIf b(i) < b(m) Thens = c(m)c(m) = c(i)c(i) = sEnd IfNext mNext iFor i = 1 To 80If fc(a(i)) = True Theng = g + 1d(g) = a(i)End IfNext iPrint "随机数:"For i = 1 To 80f = f + 1If f < 11 ThenPrint " " & a(i);Elsef = 1PrintPrint " " & a(i);End IfNext iPrintPrint "偶数:"f = 0For i = 1 To jf = f + 1If f < 11 ThenPrint " " & b(i);Elsef = 1PrintPrint " " & b(i);End IfNext iPrintPrint "奇数:"f = 0For i = 1 To kf = f + 1If f < 11 ThenPrint " " & c(i);Elsef = 1PrintPrint " " & c(i);End IfNext iPrintPrint "素数:"f = 0For i = 1 To gf = f + 1If f < 11 ThenPrint " " & d(i);Elsef = 1PrintPrint " " & d(i);End IfNext is = 0PrintPrint "素数个数:" & gFor i = 1 To gs = s + d(i)Next iPrint "素数总和:" & sEnd Sub。

本文到此分享完毕,希望对大家有所帮助。

最新更新

七夫之祸txt 七夫之祸

卡盟24小时自动发卡平台 卡盟581

江诗丹顿机械表价格及图片大全 江诗丹顿机械表

归的部首是什么部 归的部首

东京复仇者天竺篇 复仇者vsx战警

霍思燕父母 霍思燕的母亲去世了吗

诛仙3幻世西荒4怪点

预产期怎么算才最准确简单方法 预产期怎么算最准确

嗟怨读音 嗟

输赢 说一说输赢的简介

县尉县令县丞 县尉

返回
顶部