Answer to Question #231811 in Visual Basic for Grace

Question #231811
A program to calculate the sum and average of 5 students in 5 subjects
1
Expert's answer
2021-08-31T23:52:15-0400




Module Module1
    Sub Main()
        For student As Integer = 1 To 5
            Dim sum As Integer = 0
            Console.WriteLine("Enter marks for student {0}", student)
            For subject As Integer = 1 To 5
                Console.Write("Enter mark for subject {0}: ", subject)
                Dim mark As Integer
                Integer.TryParse(Console.ReadLine(), mark)
                sum += mark
            Next
            Console.WriteLine(vbNewLine + "Sum: {0}", sum)
            Dim average As Double = sum / 5.0
            Console.WriteLine("Average: {0}", average.ToString("N"))
            Console.WriteLine()
        Next


        Console.ReadLine()
    End Sub
End Module





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS