Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 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 _07GraduationPt._3
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string name = string.Empty;
  14.  
  15. while (true) /*?????*/
  16. {
  17. name = Console.ReadLine();
  18. if (name == "END") /*?????*/
  19. { break; }
  20. double sum = 0.0;
  21. int fault = 0;
  22. int i = 0;
  23. for (i = 1; i <= 12; i++)
  24.  
  25. {
  26. if (fault == 2)
  27. { break; }
  28.  
  29. double rate = double.Parse(Console.ReadLine());
  30.  
  31. if (fault == 2)
  32. { break; }
  33.  
  34. if (rate < 4 && fault < 2)
  35. {
  36. fault++;
  37. i--;
  38. }
  39.  
  40. else
  41. {
  42. sum += rate;
  43. }
  44. }
  45.  
  46. if (fault == 2)
  47. {
  48. Console.WriteLine($"{name} has been excluded at {i} grade");
  49. }
  50.  
  51. else
  52. {
  53. Console.WriteLine($"{name} graduated. Average grade: {(sum / 12):f2}");
  54. }
  55. }
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement