Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication8
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("enter the number of students");
- int students = int.Parse(Console.ReadLine());
- Console.WriteLine("enter the number of Questions");
- int questions = int.Parse(Console.ReadLine());
- char[,] MCQ = new char[students, questions];
- char[] key = new char[questions];
- Console.WriteLine("enter the answer key");
- //input of the answer key
- for (int i = 0; i < key.Length; i++)
- {
- key[i] = char.Parse(Console.ReadLine());
- }
- //input of students answers
- for (int i = 0; i < students; i++)
- {
- Console.WriteLine("enter the answers of studnet {0}",i+1);
- for (int j = 0; j < questions; j++)
- {
- MCQ[i, j] = char.Parse(Console.ReadLine());
- }
- }
- //ts7e7 el MCQ
- for (int i = 0; i < students; i++)
- {
- int counter = 0;
- for (int j = 0; j < questions; j++)
- {
- if (MCQ[i,j]==key[j])
- {
- counter++;
- }
- }
- Console.WriteLine("the number of correct answers for student {0} is {1}", (i + 1), counter);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement