Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27404

VS 2010 Homework: Sum Array Column Basics

$
0
0
Hello,

So for a homework assignment, I am to input various high and low temperatures in a two dimensional array. I think I've figured that part out, but no information was given on what to type in VB code that would enable me to sum an entire column. Ideally I would like to Sum each column separately and do an average high temp and an average low temp. How would I go about doing this?

Note: This is a console program, I'm still learning the ropes.

Any help is much appreciated!

My Code:

Sub Main()

Dim TEMP(10, 2) As Integer
Dim SumHigh As Integer = 0 'High Teperature Sum
Dim SumLow As Integer = 0 'Low Temperature Sum

Console.WriteLine("Array Creator 1.0")
Console.WriteLine()


Dim I As Integer = 0 'Initaliziing I

Do While I < 10

Console.Write("Enter low temperature: ")
TEMP(I, 1) = Console.ReadLine()


Console.Write("Enter high temperature: ")
TEMP(I, 2) = Console.ReadLine()

I = I + 1 'Loop Counter

Loop

'Console.WriteLine("Sumlow: :" & SumLow) Not active
'Console.WriteLine("SumHigh: " & SumHigh) Not active
Console.ReadLine()

End Sub

Viewing all articles
Browse latest Browse all 27404

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>