Question: Find and fix the bugs in a loop (c#) /* This program computes the average of a student's grades. The expected output is: The average
Find and fix the bugs in a loop (c#) /* This program computes the average of a student's grades. The expected output is: The average score isThe program has a syntax error (wrongly coded), a specification error (wrongly implemented), and a semantic error (wrong logic). Discuss with the instructor what each of the errors is and why they are wrong. After a response, fix the specification and semantic errors and test to ensure that the program is working as expected. */ using System; namespace IDL4 { public class scores { public static void main(string[] args) { int count = 0; int total = 0; do { Console.Write("Input score (negative value to quit): "); int score = int.Parse(Console.ReadLine()); if (score < 0) break; total = score; ++count; } while(true); Console.WriteLine("The average score is " + total / count); } } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
