Advertisement
MegastoRM

Untitled

Feb 10th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.76 KB | None | 0 0
  1. Private Sub cmdRacunaj_Click()
  2.     Dim A(1000) As Integer, ZBI As Integer, PetA As Single, ZbirA As Integer, Rezultat As Single, N As Single, i As Integer
  3.    
  4.     ZBI = Int(txtZBI.Text)
  5.     If ZBI = 0 Then
  6.         ZBI = 8
  7.     End If
  8.    
  9.     ' N = koren(5+ZBI)
  10.    
  11.    N = Sqr(5 + ZBI)
  12.    If N < 0 Then
  13.        MsgBox ("Ne moze biti -")
  14.        Exit Sub
  15.    End If
  16.  
  17.    For i = 0 To N - 1
  18.        A(i) = Val(InputBox("Unesi broj:"))
  19.    Next i
  20.    
  21.    
  22.    PetA = 1
  23.    For i = 0 To 4
  24.        PetA = PetA * A(i)
  25.    Next i
  26.    
  27.    
  28.    ZbirA = 0
  29.    For i = 0 To N - 1
  30.        ZbirA = ZbirA + A(i)
  31.    Next i
  32.    
  33.    Rezultat = PetA / ZbirA
  34.    
  35.    txtProizvod.Text = PetA
  36.    txtZbir.Text = ZbirA
  37.    txtRezultat.Text = Rezultat
  38.  
  39. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement