Part 1: Syntax errors – Locate the syntax errors in the code below and fix the errors, then run the correct code.
static void Main(string[] args) { //declare variables double num1, num2, quotient; Console.Write("Please enter a number: "); num1 = Console.ReadLine(); Console.Write("Please enter another number: "); num2 = Convert.ToDouble(Console.ReadLine()); if (num2 == 0) Console.WriteLine("Division by 0 is not allowed"); Console.WriteLine("This program will terminate"); else { quotient = num1 / num2; Console.WriteLine("The quotient of " + num1 " and " + num2 + " is " + quotient); Console.WriteLine("Thank you!"); } Console.ReadLine(); }
Part 2: Logic errors – Locate the logic errors in the code below and fix the errors. Then run the correct code.
static void Main(string[] args) { int testScore = 0; Console.Write("Please enter the test score: "); testScore = Convert.ToInt32(Console.ReadLine()); if (testScore > 60) Console.WriteLine("Your grade is an D"); else if (testScore > 70) Console.WriteLine("Your grade is a C"); else if (testScore > 80) Console.WriteLine("Your grade is a B"); else if (testScore > 90) Console.WriteLine("Your grade is an A"); else Console.WriteLine("Your grade is an F"); Console.ReadLine(); }
i need in detail on what was wrong and the corrections all in detail please and thanks again