Answer to Question #231809 in Visual Basic for Grace

Question #231809
Sum and average of 5 students in 5 subjects
1
Expert's answer
2021-09-01T06:25:23-0400




Module Module1
    Sub Main()
        For i As Integer = 1 To 5
            Dim sumMarks As Integer = 0
            Console.WriteLine("Enter marks for student {0}", i)
            For s As Integer = 1 To 5
                Console.Write("Enter mark for subject {0}: ", s)
                Dim mark As Integer
                Integer.TryParse(Console.ReadLine(), mark)
                sumMarks += mark
            Next
            Console.WriteLine(vbNewLine + "Sum: {0}", sumMarks)
            Dim average As Double = sumMarks / 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