作业帮 > 数学 > 作业

用VB求解 已知A,B为正整数,A

来源:学生作业帮 编辑:百度作业网作业帮 分类:数学作业 时间:2024/08/08 04:43:11
用VB求解 已知A,B为正整数,A
用VB求解 已知A,B为正整数,A
这个不难,你只要好好分析下就会做了
Private Sub Form_Load()
Dim tempA As Integer
Dim tempB As Integer
Dim B As Integer
Dim sum As Integer
Dim little As Integer
little = 2698
For tempA = 1 To 2698
tempB = 2698 / tempA
If tempA < tempB And 2698 Mod tempA = 0 Then
sum = tempA + tempB
End If
If sum < little Then
little = sum
B = tempB
End If
Next tempA
MsgBox B
End Su