write a visual basic program to find whether a student got A or B grade , based on his / her average mark
Answers
Answer:
Module Module1
Sub Main()
Dim m1, m2, m3, m4, m5, total As Integer
Dim name As String
Dim avg As Double
Console.WriteLine("Enter the name:")
name = Console.ReadLine()
Console.WriteLine("Enter the Marks:")
m1 = Console.ReadLine()
m2 = Console.ReadLine()
m3 = Console.ReadLine()
m4 = Console.ReadLine()
m5 = Console.ReadLine()
total = m1 + m2 + m3 + m4 + m5
avg = total / 5
Console.WriteLine("Total Marks=" & total)
Console.WriteLine("Average=" & avg)
avg = avg / 10
If (avg >= 9) Then
Console.WriteLine("Grade:A")
ElseIf (avg >= 8) Then
Console.WriteLine("Grade:B")
ElseIf (avg >= 6) Then
Console.WriteLine("Grade:C")
ElseIf (avg >= 4) Then
Console.WriteLine("Grade:D")
Else
Console.WriteLine("Grade:E")
End If
Console.ReadKey()
End Sub
End Module