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