Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string name = Console.ReadLine();
- double sum = 0;
- int clas = 1;
- int failedTimes = 0;
- while (clas <= 12)
- {
- double grade = double.Parse(Console.ReadLine());
- if (grade >= 4)
- {
- clas++;
- sum += grade;
- continue;
- }
- failedTimes++;
- if (failedTimes == 2)
- {
- Console.WriteLine($"{name} has been excluded at {clas} grade");
- break;
- }
- }
- if (clas > 12)
- {
- Console.WriteLine($"{name} graduated. Average grade: {sum/12:f2}");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement