vb程序设计 0到1000中能被7整除数字的个数
Private Sub Command1_Click()Dim i As Integer, j As Integer For i = 1 To 1000 If i Mod 7 = 0 Then j = j + 1 Next Print j End Sub
vb程序设计 0到1000中能被7整除数字的个数
回答:Private Sub Command1_Click() Dim i As Integer, j As Integer For i = 1 To 1000 If i Mod 7 = 0 Then j = j + 1 Next Print j End Sub
...1~1000]区间中的所有整数中能被3整除的数的个数及能被7整除的数...
private sub command1_click()dim i,a,b for i=1 to 1000 if i mod 3=0 then a=a+1 if i mod 7=0 then b=b+1 next print "1~1000中能被3整除的数的个数=" & a print "1~1000中能被7整除的数的个数=" & b end sub ...
设计一个算法,输出1到1000之间所有7的倍数,并画出程序框图
回答:用VB做,设置一个command 按钮。代码如下 Private Sub Command1_Click() Dim k As Integer For k = 0 To 142 '1000内7的倍数最多为142倍 Print k * 7 '输出倍数在乘以7就可以得到1000内能整除7的数 Next k End Sub 希望对你有帮助,O(∩_∩)O哈哈~ 或者这个#include <stdio.h> #...
...能够被3整除的个数以及能够被7整除的个数。程序代码怎么写?_百度...
private sub command1_click dim sum as integer'和 dim count as integer'个数 sum=0 count=0 text3.text=""For i=1 to 100 If i Mod 3=0 And i Mod 7<>0 Then count=count+1 sum=sum+i text3.text=text3.text & i'text3显示都有什么数 End If Next text1.text="和为:"+...
VBA 计算被7整除的数字个数
VBA 计算被7整除的数字个数的程序:Sub aaa()Dim n As Integer, i As Integer, he As Integer n = Application.InputBox("请输入自然数", "最大值", 0, , , , , 1)For i = 0 To n If i Mod 21 = 0 Then he = he + i End If Next MsgBox he ^ (1 \/ 2)End Sub Visua...
编写vb程序自然数1∼1000中能被5和7同时整除时的数打印出来,并统计其...
新建一个工程,添加一个Command1,添加一个List1 Private Sub Command1_Click()Dim Sum As Long Sum = 0 For i = 1 To 1000 If i Mod 5 = 0 And i Mod 7 = 0 then list1.additem i:Sum = Sum +1 Next MsgBox "1-1000中能被5和7同时整除的数有" & Sum & "个"End Sub ...
谁会VB求一个数的阶乘和打印1到100之间能被7整除的数啊
一个数的阶乘,例如10:dim i as integer'循环控制变量 dim mul as integer'用来存乘积 mul=1 for i=1 to 10 mul=mul*i next i print mul 打印1到100之间能被7整除的数:dim i as integer for i=1 to 100 'mod意思为取模,取出余数,如果余数为0说明能被7整除 if i mod 7=0 then...
VB题:统计m到n之间能被7整除的数的个数。
)n = Val(InputBox("请输入第二个整数:"))k = 0 If m > n Then t = m: m = n: n = t End If k = 0 For i = m To n If i Mod 7 = 0 Then k = k + 1 Next i MsgBox ("从 " & m & " 到 " & n & " 之间能被7整除的数的个数 = " & k)End Sub ...
在vb中如何在100以内能够整除7的数打印出来
Dim str As String = "" For i = 1 To 100 If i Mod 7 = 0 Then str = str & i & " " End If Next TextBox6.Text = str运行结果:7 14 21 28 35 42 49 56 63 70 77 84 91 98