Although the following code compiles and runs, the programmer broke some major r
ID: 3551184 • Letter: A
Question
Although the following code compiles and runs, the programmer broke some major readability rules. Describe at least three changes that would make it easier for other programmers to read and understand the code.
class Program { static void Main() //TBD
{
double count;
double Double = 10; // declare variables
for(int i = 0;i < Double;i++) //keep doing
{
count=function(i);
Console.WriteLine(count);
}
Console.Read();
}
public static double function(int a) //a function
{
return (Math.Sqrt(a));
}
}
Explanation / Answer
1). Make it coloured for example use different colour for user function than calling built in function.
2). Use tab space when using "for loop"
3).Use new line to start "Main()" function
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.