public static void Main()
string[] key = {"B", "D", "A", "A", "C", "A", "B", "A", "C", "D"};
string[] stu = {"B", "D", "A", "A", "C", "A", "B", "E", "E", "E"};
int correct = results(stu, key);
static int results(string[] stu, string[] key)
for (int index = 0;index <key.Length; index++)
if (stu[index] == key[index])
Console.WriteLine("Question " + (index+1) + ": Your answer of " + stu[index] + " is correct.");
Console.WriteLine("Question " + (index+1) + ": Your answer of " + stu[index] + " is wrong.");
total = correct + incorrect;
Console.WriteLine("Your score is " + correct.ToString() + " out of " + total.ToString());
static void passfail(int correct)
Console.WriteLine ("Congratulations! You passed!");
Console.WriteLine ("You did not pass. Please try again.");