1 / 16
文档名称:

vb编程题.doc

格式:doc   大小:97KB   页数:16页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

vb编程题.doc

上传人:ipod0a 2017/9/8 文件大小:97 KB

下载得到文件列表

vb编程题.doc

相关文档

文档介绍

文档介绍:. 第一道编程题
,并求这10个整数的最大值,最小值,平均值以及和
Option Base 1
Private mand1_Click()
Dim A(10) As Iinteger,I As Integer
Dim Max As Integer,Min as Integer
Dim Sum as Integer,Ave as Integer
Randomize
For i=1 To 10
A(i)=Int(Rnd*90)+10
Next i
Max=A(1)
Min=A(1)
For i=1 To 10
If A(i) > Max Then Max = A(i)
If A(i) < Min Then Min = A(i)
Sum =Sum + 1
Next i
Ave =Sum \10
Print”最大值是:”;Max
Print”最小值是:”;Min
Print”10个数的和是:”;Sum
Print”平均值是:”;Ave
End Sub

Option Explicit
Private mand1_Click()
Dim I As Iinteger
Dim a As Iinteger
Dim b As Iinteger
Dim c As Iinteger
For i = 100 to 999
a = i \ 100
b = i \ 10 Mod 10
c = i Mod 10
If I = a * a * a + b * b * b + c * c * c Then
Picture1. Print i
End If
Next i
End Sub

Option Explicit
Private Sub cmdCalc_Click()
Dim x As Iinteger
Dim y As Iinteger
Dim z As Iinteger
“公鸡母鸡小鸡“
For x = 1 To 10
For y = 1 To 33
z = 100 – x – y
If 5 * x + 3 * y + z / 3 = 100 Then
CStr(x) & Space (6) & CStr(y) & Space(6) & CStr(z)
End If
Next y
Next x
End Sub

(一个数如果恰好等于它的因子之和,这个数就称为"完数")
Option Base 1  
Private mand1 _Click()
Dim n As Iinteger
Dim i As Iinteger
Dim j As Iinteger
For i = 2 To 1000
n= 0
For j = 1 To i - 1
If i Mod j = 0 Then
n= n + j
End If
Next j
If i = n Then Print i;
Next i
End Sub

Private mand1 _Click()
Dim i As Integer,n As Integer,m As Integr
n= InputBox(“输入一个正整数”)
For i = 1 to Len(Str(n))
m = m + Val (Mid(n,i,1)
Next i
= m
End Sub

Private mand1 _Click()
Dim m As Integer,n As Integer,i As Integer
m = Text1
n = Text2
If n< m Then
i = n
n = m
m = i
End If
For i = m To m * n
If i Mod m = 0 And I Mod n = 0Then
= i
End If
End Sub

Private mand1 _Click()
Dim m As Integer,n As Integer,a As Integer
X =
Do While x<>0
A = x mod 10
y = y * 10 + a
x = x \ 10
Loop