Advertisement
kav128

Untitled

Apr 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim SumNegative As Double = 0
  2. Dim CountNegative As Integer = 0
  3. Dim NegativeAverage As Double
  4. If B < 0 Then
  5.     SumNegative = SumNegative + B
  6.     CountNegative = CountNegative + 1
  7. End If
  8. If D < 0 Then
  9.     SumNegative = SumNegative + D
  10.     CountNegative = CountNegative + 1
  11. End If
  12. If F < 0 Then
  13.     SumNegative = SumNegative + F
  14.     CountNegative = CountNegative + 1
  15. End If
  16.  
  17. If CountNegative = 0 Then
  18.     MsgBox "Ну, типа нечего нам считать"
  19. Else
  20.     NegativeAverage = SumNegative / CountNegative
  21. End If
  22.  
  23.  
  24. Dim ProductOdd As Double = 1
  25. Dim CountOdd As Integer = 0
  26. Dim OddAverage As Double
  27. If B Mod 2 = 1 Then
  28.     ProductOdd = ProductOdd * B
  29.     CountOdd = CountOdd + 1
  30. End If
  31. If D Mod 2 = 1 Then
  32.     ProductOdd = ProductOdd * D
  33.     CountOdd = CountOdd + 1
  34. End If
  35. If F Mod 2 = 1 Then
  36.     ProductOdd = ProductOdd * F
  37.     CountOdd = CountOdd + 1
  38. End If
  39.  
  40. If CountOdd = 0 Then
  41.     MsgBox "Ну, типа нечего нам считать"
  42. Else
  43.     OddAverage = ProductOdd ^ (1 / CountOdd)
  44. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement