Advertisement
zarkoy

Untitled

Nov 5th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5.  
  6. namespace test
  7. {
  8. class Program
  9. {
  10. public static void Main()
  11. {
  12. string name = Console.ReadLine();
  13. int clas = 0;
  14. int failCounter = 0;
  15. double grades = 0.00;
  16. bool graduated = true;
  17.  
  18. while (clas < 12)
  19. {
  20. clas++;
  21. double grade = double.Parse(Console.ReadLine());
  22. grades += grade;
  23.  
  24. if (grade < 4.00)
  25. {
  26. failCounter++;
  27. }
  28. if (failCounter == 2)
  29. {
  30. Console.WriteLine($"{name} has been excluded at {clas - 1} grade");
  31. graduated = false;
  32. break;
  33. }
  34. }
  35.  
  36. if (graduated)
  37. {
  38. double averageGrade = grades / 12;
  39. Console.WriteLine($"{name} graduated. Average grade: {averageGrade:f2}");
  40. }
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement