Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What problems exist within the following code? C# Explain each problem, and indi

ID: 642563 • Letter: W

Question

What problems exist within the following code? C#

Explain each problem, and indicate whether it is a syntax error or a logic error.

C# Programing Language

long N; string X; double B; long M; long Q = 4; long R = 3;

N = Console.WriteLine();

// Countdown 5 to 3

or (int I = 5; (I <= 3); I--) { if ((I > 3)) X = 6; else X = 45.3;

}

N = 45 / M;

while (Q > R) { Q++;90 }

// Add 1 to Q and then multiply it by 2

Q = 1 + (Q * 2);

Console.ReadLine();

What problems exist within the following code? C# Explain each problem, and indicate whether it is a syntax error or a logic error. C# Programing Language long N; string X; double B; long M; long Q = 4; long R = 3; N = Console.WriteLine(); // Countdown 5 to 3 or (int I = 5; (I 3)) X = 6; else X = 45.3; } N = 45 / M; while (Q > R) { Q++;90 } // Add 1 to Q and then multiply it by 2 Q = 1 + (Q * 2); Console.ReadLine();

Explanation / Answer

Error in N = Console.WriteLine(); change it to N = Console.ReadLine(); because you want to read in a number to N

This is syntax error

Error in X = 6. change it to X = "6"; because X is a string variable

Error in X = 45.3. change it to X = "45.3"; because X is a string variable

Error in N = 45 / M; M is not initialized

Error in Q = 1 + (Q * 2) change it to Q = (1 + Q) * 2;

all the errors are syntactical except for the last one

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote