maximkustreev

Untitled

Apr 13th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.36 KB | None | 0 0
  1. Sub easy()
  2.  
  3. Dim t As Integer, s As Integer, n As Integer, i As Integer
  4. s = 0
  5. n = InputBox("Введите n")
  6. If (n = 0) Then MsgBox ("Неверно введено n"): End
  7. Call fact(n)
  8.  
  9. End Sub
  10.  
  11. Sub fact(n)
  12.  
  13. For i = 1 To n
  14.    t = 1 / i
  15.    s = s + t
  16.    Next i
  17. MsgBox "Сумма первых " & n & " членов ряда равна " & s
  18.  
  19. End Sub
Advertisement
Add Comment
Please, Sign In to add comment