' Project AveWordLength ' Read words from the file c:\Words.txt and ' output the average word length. Imports System.Console, System.IO Public Module Module1 Public Sub Main() Dim word As String Dim lengthSum = 0, wordCount As Integer = 0 Dim average As Double ' Create StreamReader object ' Place Words.txt file in bin folder. Dim reader As New StreamReader("Words.txt") ' Count total length and count of words. While reader.Peek() >= 0 word = reader.ReadLine() lengthSum += word.Length wordCount += 1 End While ' Compute and display average word length. average = lengthSum / wordCount WriteLine("Average word length is " & average.ToString("#0.00")) ReadLine() End Sub End Module