Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace New_07.Graduation_pt._3
- {
- using System;
- class StartUp
- {
- public static void Main()
- {
- string name = Console.ReadLine();
- while (name != "END")
- {
- double sum = 0;
- int counter = 0;
- bool isStuding = true;
- for (int i = 0; i < 12; i++)
- {
- double grade = Double.Parse(Console.ReadLine());
- if (grade >= 4.00)
- {
- sum += grade;
- }
- else if(grade < 4)
- {
- if (!isStuding)
- {
- break;
- }
- isStuding = false;
- i--;
- counter++;
- if (counter == 2)
- {
- Console.WriteLine($"{name} has been excluded at {i} grade");
- }
- }
- }
- double averageGrade = sum / 12;
- Console.WriteLine($"{name} graduated. Average grade: {averageGrade:F2}");
- name = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement