----------------------------------------------
Private Sub Form_Click()
Dim i As Integer, j As Integer, sum As Integer
Dim str As String
i = 1: j = 1
For i = 1 To 9
For j = 1 To i
sum = i * j
Print i; " *"; j; " ="; sum
If i = j Then
Print
End If
Next j
Next i
End Sub
----------------------------------------------
我写的程序是这样的,显示的效果是竖着排下去的。
1 * 1 = 1
2 * 1 = 2
2 * 2 = 4
3 * 1 = 3
3 * 2 = 6
3 * 3 = 9
……
……
……
请问我该如何换行?代码如何修改?
新手上路
求详解!谢谢
请教:VB编程,乘法口诀如何解决?
答案:3 悬赏:70 手机版
解决时间 2021-03-05 12:55
- 提问者网友:流星是天使的眼泪
- 2021-03-05 05:42
最佳答案
- 五星知识达人网友:躲不过心动
- 2021-03-05 06:52
sum后加逗号更合适一些,而且程序这样改更简洁:
Private Sub Form_Click()
Dim i As Integer, j As Integer, sum As Integer
For i = 1 To 9
For j = 1 To i
sum = i * j
Print i; " *"; j; " ="; sum,
Next j
Print
Next i
End Sub
Private Sub Form_Click()
Dim i As Integer, j As Integer, sum As Integer
For i = 1 To 9
For j = 1 To i
sum = i * j
Print i; " *"; j; " ="; sum,
Next j
Next i
End Sub
全部回答
- 1楼网友:woshuo
- 2021-03-05 08:25
在循环里面的Print i; " *"; j; " ="; sum语句后面加一个分号就可以了,即:
Print i; " *"; j; " ="; sum;
- 2楼网友:风格不统一
- 2021-03-05 07:05
设置form1的wiondowstate的值为2,即最大化。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯