Having issues ending senteniel controlled loop in c# homework?

heres my homework assignment: Write a program to calculate the average of all the scores entered between 0 and 100. use a sentinel controlled loop variable to termintate the loop. after values are entered and the average calculated, test the average to determine whether an A,B,C,D, or F should be recorded. This is... show more heres my homework assignment: Write a program to calculate the average of all the scores entered between 0 and 100. use a sentinel controlled loop variable to termintate the loop. after values are entered and the average calculated, test the average to determine whether an A,B,C,D, or F should be recorded. This is the scoring rubric. A-90-100; B-80-89; C-70-79; D-60-69; F < 60.


below is what ive completed with the help from a buddy, i was having an issue ending the loop, and he just left for work, yet i dont quite understand why to end the loop i must use a negative value, yet dont quite see where/how to change it. anyone able to provide some input please?






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace chap6que3
{
class Program
{

static void Main(string[] args)
{
int [] marks;
int minput=1,counter=0,total=0;
float aveg = 0.0f;
String Gradeletter = "C";
marks= new int[100];
Console.WriteLine("Enter Student Grade");
while (minput >0)
{
minput = Convert.ToInt32(Console.ReadLine());
if (minput >= 0)
{
marks[counter++]=minput;
total += minput;

Console.WriteLine("Enter student grade or any negative value to calculate average");
}



}
aveg = (float)total / (float)counter;
Console.WriteLine("Average Grade %: " +aveg.ToString());

if (aveg < 60)
{
Gradeletter = "F";

}
else if (aveg >= 60 && aveg < 70)
{
Gradeletter = "D";

}
else if (aveg >= 70 && aveg < 80)
{
Gradeletter = "C";

}
else if (aveg >= 80 && aveg < 90)
{
Gradeletter = "B";

}
else if (aveg >=90)
{
Gradeletter = "A";

}
Console.WriteLine("Letter grade average is: " + Gradeletter);
Console.ReadKey();
}
}
}
1 answer 1