Advertisement
haquaa

Untitled

May 26th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _2015_C_sharp_Exam
  8. {
  9.     class Program
  10.     {
  11.         /*
  12.             el mas2ala de el doctor msh mewada7 feeha ay tafaseel ..
  13.             fa ana ha7el 3ala 7asab ma fehemt we bel taree2a elly
  14.             te3gebny , momken kol wa7ed ye7elaha b taree2a ..
  15.             ScreenShot of Console : http://i.imgur.com/6k3hpsz.png
  16.          */
  17.  
  18.         static void Main(string[] args)
  19.         {
  20.             //question 3 - c
  21.  
  22.             Console.Write("Enter the number of students : ");
  23.  
  24.             int NumberOfStudents = int.Parse(Console.ReadLine());
  25.  
  26.             Console.Write("Enter the number of questions : ");
  27.  
  28.             int NumberOfQuestions = int.Parse(Console.ReadLine());
  29.  
  30.             char[] questionAnswer = new char[NumberOfQuestions];
  31.  
  32.             Console.WriteLine("Enter the answer key of each question : ");
  33.  
  34.             for(int i = 0; i < NumberOfQuestions; i++)
  35.             {
  36.                 questionAnswer[i] = char.Parse(Console.ReadLine());
  37.             }
  38.  
  39.             for(int i = 0; i < NumberOfStudents; i++)
  40.             {
  41.                 Console.WriteLine("Enter the question Answer of student {0} :" , i+1);
  42.                 int counter = 0;
  43.                 for(int y = 0; y < NumberOfQuestions; y++)
  44.                 {
  45.                     char answer = char.Parse(Console.ReadLine());
  46.                     if(answer == questionAnswer[y])
  47.                     {
  48.                         counter++;
  49.                     }
  50.                 }
  51.                 Console.WriteLine("Student {0} solved {1} correct answers" , i+1 , counter);
  52.             }
  53.  
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement