my program does number of students and total marks they gained but doesn't do average and how many failed.
please let me know how to convert my total into average and display how many students have failed
Sub Main() Dim p, total As Double Dim Answer As String = "yes" Dim numberofstudents As Integer Dim average As Double total = 0 numberofstudents = 0 p = 0 average = total / numberofstudents Console.WriteLine(" enter a mark, yes or no??") Answer = Console.ReadLine() Do While Answer = "yes" numberofstudents = numberofstudents + 1 Console.WriteLine(" what is your mark?") p = Console.ReadLine total = total + p Console.WriteLine(" would you like to know more?") Answer = Console.ReadLine() Loop Console.WriteLine(" average is " & total & " for " & numberofstudents & " students ") Console.ReadLine() End sub
This post has been edited by AdamSpeight2008: 11 April 2013 - 02:45 PM