# Array of positive and negative numbers VB.Net Exercise - Visual Basic Programming Course

### Code

``````Imports System
Public Class exercise75
Public Shared Sub Main()
Dim numbers As Single() = New Single(9) {}
Dim totalPositive As Single = 0.0F
Dim totalNegative As Single = 0.0F
Dim countPositive As Integer = 0
Dim countNegative As Integer = 0

For i As Integer = 0 To 10 - 1
Console.Write("Number {0}= ", i + 1)
numbers(i) = Convert.ToSingle(Console.ReadLine())
Next

For i As Integer = 0 To 10 - 1

If numbers(i) < 0 Then
totalNegative = totalNegative + numbers(i)
countNegative += 1

If numbers(i) > 0 Then
totalPositive = totalPositive + numbers(i)
countPositive += 1
End If

Console.WriteLine("Average numbers negatives = {0}", totalNegative / countNegative)
Console.WriteLine("Average numbers positives = {0}", totalPositive / countPositive)
End If
Next
End Sub
End Class``````

### More VB.Net Exercises of Arrays, Structures and Strings

##### Household accountsCreate a program in Visual Basic (VB.Net) that can store up to 10000 costs and revenues, to create a small domestic accounting system. For each expens...

Juan A. Ripoll - Systems Tutorials and Programming Courses © 2024 All rights reserved.  Legal Conditions.