Advertisement
zarkoy

Untitled

Nov 5th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 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.  
  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 exluded at {clas - 1} grade");
  31. break;
  32. }
  33. if (clas == 12)
  34. {
  35. double averageGrade = grades / 12;
  36. Console.WriteLine($"{name} graduated. Average grade: {averageGrade:f2}");
  37. }
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement