Class Score Calculator

I want to make for the following problem. I have made the program but dont know whats wrong in my program (I have made the program in VB). It does not calculates highest and lowest correctly. Plz suggest any changes.
[u]Problem:[/u]
"A teacher has given a test to his class. He would like to have the average score for the class, and the highest and lowest scores."

Private Sub Command1_Click()
Cls
Sum = 0
lowest = 9999
highest = 0
stu = InputBox("Enter Total Number of Students in the class:")
For i = 1 To stu
marks = InputBox("Enter Marks of Student")

If highest < marks Then
highest = marks
End If

If lowest > marks Then
lowest = marks
End If

Sum = Sum + marks
Next
Avg = Sum / stu
Print "Average Score: ", Avg
Print "Highest Score: ", highest
Print "Lowest Score: ", lowest
End Sub
Last edited on
This is a C++ forum.
I suggest you try a VB forum.
I just want to know if there is any flaw in the logic. I have joined this forum because i am doing master in computer science and we will study c++ in 2-3 weeks time. Meanwhile we are given these problems to solve (just algorithm and flowchart). So i am checking my algorithms on visual basic. If its against rules plz tell me. I will refrain asking questions like these.
Plz help.......
My program is calculating average and highest marks fine but not calculating lowest marks. Whats the problem in my logic?
Topic archived. No new replies allowed.