## MathSpeeder – Firing neurons and nimbling fingers

Alright, it’s been kinda boring lately… so I’ve decided to whip up a picker-upper that will rejuvenate your brain and excite you again. You’ll be churning out flawless code in no time after this.

Enter the MathSpeeder.

MathSpeeder is a console program that fires a series of math questions. Your job is to answer all of them correctly. Oh yeah, you’ll be timed too. Ain’t that cool? Here’s the source code:

const int cnNumberOfQuestions = 10;
string response = string.Empty;
Console.WriteLine("MathSpeeder - Firing neurons and nimbling fingers");
Console.WriteLine("There are {0} math questions", cnNumberOfQuestions);
Console.WriteLine();
if (response.Equals("y"))
{
int score;
Random rand = new Random();
score = 0;
DateTime start, end;
start = DateTime.Now;
int i;
for (i = 0; i < cnNumberOfQuestions; ++i)
{
operand1 = rand.Next(1000);
operand2 = rand.Next(1000);
result = operand1 + operand2;
response = string.Format("Q{0}", i + 1).PadLeft(3);
Console.Write("{0}: {1} + {2} = ", response, operand1, operand2);

try
{
{
++score;
Console.WriteLine("     Correct!\n");
}
else
{
Console.WriteLine("     Wrong!\n");
}
}
catch
{
Console.WriteLine("     Wrong!\n");
}
}
end = DateTime.Now;
TimeSpan ts = end - start;
Console.WriteLine("You got {0} correct answers out of {1} questions", score, cnNumberOfQuestions);
Console.WriteLine("Total time taken: {0,0:f2} seconds", ts.TotalSeconds);
Console.WriteLine("Average time per question: {0,0:f2} seconds", ts.TotalSeconds / (double)cnNumberOfQuestions);
}
else
{
Console.WriteLine("Challenge the MathSpeeder next time then!");
}

Console.WriteLine();
Console.WriteLine("End of program");