欢迎访问服务器技术网-www.fuwuqijishu.com

随机产生20个两位正整数,求其中偶数的个数及和。

程序设计 fuwuqijishu 2年前 (2022-10-01) 31次浏览 0个评论 扫描二维码

Private Sub Command1_Click()
Dim i As Integer, count As Integer, n As Integer, sum As Integer
Randomize
For i = 1 To 20
n = Int(Rnd * 90 + 10)
If n Mod 2 = 0 Then
count = count + 1
sum = sum + n
End If
Next i
MsgBox “count, sum = ” & count & “, ” & sum
End Sub

喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

Warning: error_log(/www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/#log/log-2408.txt): failed to open stream: No such file or directory in /www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/spider.class.php on line 2900