Advertisement
AnastasiyaG

Untitled

Oct 3rd, 2019
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Graduation
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string studentName = Console.ReadLine();
  10. int count = 0;
  11. double yearGrade = 0.0;
  12. int end = 0;
  13.  
  14. while (count < 12)
  15. {
  16. double grade = double.Parse(Console.ReadLine());
  17. if (grade >= 4.0)
  18. {
  19. yearGrade += grade;
  20. count++;
  21. }
  22. else if (grade < 4)
  23. {
  24. end++;
  25.  
  26. if (end > 1)
  27. {
  28. count++;
  29. Console.WriteLine($"{studentName} has been excluded at {count} grade");
  30. break;
  31. }
  32. }
  33. }
  34.  
  35. double finalGrade = yearGrade / 12;
  36.  
  37. if (finalGrade >= 4.00 || count==12 )
  38. {
  39. Console.WriteLine($"{studentName} graduated. Average grade: {finalGrade:f2} ");
  40. }
  41.  
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement