Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name;
- while ((name = Console.ReadLine()) != "END")
- {
- bool isStuding = true;
- double grades = 0;
- int schoolYear = 1;
- for (int i = 1; i <= 12; i++)
- {
- double yearGrade = double.Parse(Console.ReadLine());
- if (yearGrade < 4)
- {
- if (!isStuding)
- {
- break;
- }
- isStuding = false;
- i--;
- }
- else
- {
- grades += yearGrade;
- schoolYear++;
- }
- }
- if (schoolYear - 1 == 12)
- {
- double average = grades / 12;
- Console.WriteLine(($"{name} graduated. Average grade: {average:F2}"));
- }
- else
- {
- Console.WriteLine(($"{name} has been excluded at {schoolYear } grade"));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement