VB判断整除并整除
来源:互联网 发布:mac写入不了移动硬盘 编辑:程序博客网 时间:2024/05/18 02:47
Private Sub Command1_Click()
Dim m As Integer, n As Integer, d As Integer
Dim s As Long '保存结果
m = Val(Text1.Text)
n = Val(Text2.Text)
d = Val(Text3.Text)
s = 0
sum m, n, d, s
Label4.Caption = m & "到" & n & "之间能被" & d & "整除的数之和是" & s
End Sub
Private Sub Command2_Click()
End
End Sub
'sub过程:求m到n之间能d被整除的数之和
Public Sub sum(x As Integer, y As Integer, z As Integer, w As Long)
Dim i As Integer
'若x>Y,交换
If x > y Then
t = x: x = y: y = t
End If
For i = x To y
If i Mod z = 0 Then
w = w + i
End If
Next i
End Sub
Private Sub text1_KeyPress(KeyAscii As Integer)
If Not IsNumeric(chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub text2_KeyPress(KeyAscii As Integer)
If Not IsNumeric(chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
Private Sub text3_KeyPress(KeyAscii As Integer)
If Not IsNumeric(chr(KeyAscii)) And KeyAscii <> 8 Then
KeyAscii = 0
End If
End Sub
- VB判断整除并整除
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除并求和
- 判断整除
- 判断整除
- 整除
- 整除
- 整除
- 搜狗手机输入法 iPhone 版宣布开放 App 集成接口
- DevExpress GridControl使用方法总结
- ABAP 当前日期后或者前几个月的日期
- 求数组中最长递增子序列
- 生活中的幽默感
- VB判断整除并整除
- iOS开发之详解剪贴板
- Axis2
- 改变键盘的颜色
- C#入门学习-----菜单应用(添加剂快捷方式、设置菜单项是否可用、修改菜单字体、创建级联菜单、级联菜单的动态合并)
- iPhone几种截屏的代码分享
- Eclipse3.7.2 修改字体为Courier New
- [C#]DataTable常用操作总结
- jsp 首页面向弹出层传值并回显;