Advertisement
Guest User

School

a guest
Oct 13th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. private void School()
  2.         {
  3.             const int studentsCount = 4,subjectsCount=2;
  4.             float[] result = new float[subjectsCount];
  5.             float[] total= new float[studentsCount];
  6.  
  7.             for (int i = 0; i < studentsCount; i++)
  8.             {
  9.                 int fails = 0;
  10.                 float sum = 0;
  11.                 Console.WriteLine("\n Student Number " + (i + 1));
  12.                 for (int j = 0; j < subjectsCount; j++)
  13.                 {
  14.                     Console.Write("subject {0}: ", (j + 1));
  15.                     result[j] = float.Parse(Console.ReadLine());
  16.                     if (result[j]<50)
  17.                     {
  18.                         fails += 1;
  19.                     }
  20.                     sum += result[j];
  21.                 }
  22.                 Console.WriteLine("Your total degrees is: " + sum);
  23.                 Console.WriteLine("number of subjects you failed in: " + fails);
  24.                 total[i] = sum;
  25.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement