kwrl.net
当前位置:首页 >> 怎样用VB打出下面的图形啊,在线急等 5 4 3 2 1 4 ... >>

怎样用VB打出下面的图形啊,在线急等 5 4 3 2 1 4 ...

print "5 4 3 2 1" print "4 3 2 1 2" print "3 2 1 2 3" print "2 1 2 3 4" print "1 2 3 4 5"

如果不需要换行就把 两个next中间的print 去掉。 Private Sub Command1_Click() n = InputBox("请输入最大数字") For i = 1 To n For j = 1 To i Print j & " "; Next Print "" Next End Sub

Private Sub Command1_Click() Dim s As String For i = 1 To 5 s = "" For j = 1 To 5 - i + 1 s = s & j Next j Print s Next i End Sub 这个是你要的

Private Sub Command1_Click() 'n自己填,我这里填的6 MsgBox test1(6) & " = " & test(6)End Sub '你要的算法主要是这个。。。 Private Function test(ByVal n As Long) As Double If n > 0 Then test = test(n - 1) + 1 / (n + n + 1) Else te...

1: Dim i As Integer Dim s As Double Dim s0 As Double For i = 1 To 100 s0 = 1 / i If i Mod 2 = 0 Then s0 = s0 * (-1) s = s + s0 Next Print s 2: Dim i As Integer Dim s As Double For i = 1 To 100 Step 2 s = s + 1 / i - 1 / (i + 1)...

Private Sub Command1_Click() n=inputbox("请输入n:") Dim a As integer a = 1 Dim sum As Double For i = 1 To n For j = 1 To i a = a * j Next sum = sum + 1 / a a = 1 Next Print sum End Sub

Private Sub zgc(x, diff) Dim i As Integer For i = 3 To x If i Mod 2 Then diff = diff - 1 / i Else diff = diff + 1 / i End If Next iEnd SubPrivate Function zhs(x) As Double Dim i As Integer For i = 3 To x If i Mod 2 Then diff = ...

是不是这样啊? Private Sub Form_Click() Me.AutoRedraw = True Me.Cls Dim strTmp As String Dim strComent As String Dim i As Long strTmp = InputBox("请输入i:") If IsNumeric(strtmpe) Then If Val(strTmp) > 1 Then strComent = "S = "...

Private Sub Command1_Click() n=inputbox("请输入n:") Dim a As integer a = 1 Dim sum As Double For i = 1 To n For j = 1 To i a = a * j Next sum = sum + 1 / a a = 1 Next Print sum End Sub

Private Sub Command1_Click() s = 0 t = 1 For i = 1 To 5 t = t * i s = s + t Next i Print "1!+2!+3!+4!+5!="; s End Sub

网站首页 | 网站地图
All rights reserved Powered by www.kwrl.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com