Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Graduation_pt._2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string student = Console.ReadLine();
- double grade = double.Parse(Console.ReadLine());
- int currentClass = 1;
- double allGrade = 0;
- while (currentClass <= 12)
- {
- if (grade < 4)
- {
- Console.WriteLine($"{student} has been excluded at {currentClass} grade");
- break;
- }
- if (grade >= 4)
- {
- allGrade += grade;
- currentClass++;
- }
- if (currentClass < 13)
- {
- grade = double.Parse(Console.ReadLine());
- }
- }
- if (currentClass==13)
- {
- double average = allGrade / 12;
- Console.WriteLine($"{student} graduated. Average grade: {average:F2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment