Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Graduation
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- double sumGrades = 0;
- int counter = 1;
- int fail = 0;
- while (counter <= 12)
- {
- double grade = double.Parse(Console.ReadLine());
- if (grade >= 4)
- {
- sumGrades += grade;
- counter++;
- if (counter == 13)
- {
- Console.WriteLine($"{name} graduated. Average grade: {sumGrades / 12:F2}");
- break;
- }
- }
- else
- {
- fail++;
- if (fail == 2)
- {
- Console.WriteLine($"{name} has been excluded at {counter} grade");
- break;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement