用VB的do...loop循环写语句!!!急!!!求大神!!!
+n的值大于1000时n的值是:" & y'第四题 c = 1: y = 1 Do y = y + 1 c = c + 1 \/ y If c >= 2 Then Exit Do '大于10改成c>=10 ===大于15改成if c>=15 Loop MsgBox "定义S=1+1\/2+1\/3+……+1\/n,求当s>=2时的最小的n值:" & y ...
vb程序:求满足1^2+2^2+3^2+…+n^2>1000的最小值的程序
如图所示,n=14时,和为1015。望采纳。。。
请问在VB里面如何设计程序找出1000以内的完数?
1、启动VB6.0,新建一个标准exe工程。2、在窗体上绘制一个命令按钮,名称为Command1。3、双击命令按钮进入代码窗口。4、编写命令按钮的单击事件。Private Sub Command1_Click()For n = 1 To 1000 s = "" '这一句要加上 Sum = 0 For i = 1 To n \/ 2 If n Mod i = 0 Then Sum = ...
用VB编程写出1+2+3+4..一直加到大于10000 最后的数字的什么 怎么写
dim i as integer s = 0 \/\/和初始化 i = 0 \/\/加数初始化 do while s <10000 i = i + 1 \/\/每次循环自增1 s = s + i \/\/求和 loop print i \/\/输出加到大于10000最后的数字
vb里面运用计数循环结构计算出1+2+3+...+N 求过程
Dim num, sum As Integer num = a1.Text For i As Integer = 1 To num sum += i Next response.write("1+...+" & num &"=" &sum)a1和a2是页面中的文本框 根据文本框输入的值,计算和,再显示在页面上
vb代码求1+2+3+...+n的代码?
Sub jisuan() Dim n As Integer Dim sum As Integer sum = 0 n = InputBox("请输入数字n") For i = n To 1 Step -1 sum = sum + i Next MsgBox(sum) End Sub
VB 计算 1+2+3+。。。n的代码怎么写啊?
2,首先你在窗体上放一个text.text控件(用来显示结果)和command按钮控件 Private Sub Command1_Click()dim n as long dim b as long for n=2 to 50 step 2 b=b+n next n text1.text=b end sub 把代码放到command1按钮里,单击command1按钮就能在text1.text中显示结果 3,首先你在窗体上放...
VB编程:求1!+2!+3!+...+N!(N为任意正整数)
If nl < 1 Then nl = 1 '最小长度是1位,若真到了这么大的数,恐怕没人会去试了^-^ n = 10 ^ nl '缓存用于分隔大数的被除数,数组中每个元素的长度是 nl,该数就是10的 nl 次方 result(1) = 1 x = 1 Do While x <= num last = 0 For i = 1 To numlen m = res...
满足1+2+3+...+n>2600的最小n值 vb
Private Sub Command1_Click()Dim i As Integer, sum As Integer i = 0 sum = 0 While (sum < 2600)i = i + 1 sum = sum + i Wend Print i - 1 End Sub
VB中用for循环结构语句编写程序,计算1+2+3+...+100.
Private Sub Form_Click() Dim i As Integer, sum As Integer sum = 0 For i = 1 To 100 sum = sum + i Next Print "总和为:" & sumEnd Sub