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