[Solved] Writing a C# program for class and I cannot figure out where it is going wrong


You are kind of not using if else if else correctly. You want to test for each letter grade appropriately. Each test for the grade is a if => else if.. If you don’t get an A, do you get a B? Do you get a C? Do you get a D, or do you get an F – and you need to nest the logic appropriately. I’ll also note that the end of your logical container blocks was incorrect. You want to calculate the logic and then execute the WriteLine();.. Keep it all separate.

 //processes
            if (score < 0 || score > 1000)
            {
                Console.WriteLine("Invalid Score");
            }
            else
            {
                percent = score/1000;

                if (percent >= .9)
                {
                    grade = "A";
                }
                else if (percent >= .8)
                {
                    grade = "B";
                }
                else if (percent >= .7)
                {
                    grade = "C";
                }
                else if (percent >= .6)
                {
                    grade = "D";
                }
                else
                {
                    grade = "F";
                }

1

solved Writing a C# program for class and I cannot figure out where it is going wrong