Advertisement
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 DomashnoGraduationPt2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfInputs = 1;
- double gradeAcumulate = 0.00;
- int excludedAcumulate = 0;
- string name = Console.ReadLine();
- while (numberOfInputs <= 12 && excludedAcumulate < 2)
- {
- double grade = double.Parse(Console.ReadLine());
- if (grade >= 4.00)
- {
- gradeAcumulate += grade;
- numberOfInputs++;
- }
- else
- {
- excludedAcumulate += 1;
- }
- }
- if (excludedAcumulate < 2)
- {
- double averageGrade = 1.00 * gradeAcumulate / (numberOfInputs - 1);
- Console.WriteLine($"{name} graduated. Average grade: {averageGrade:f2}");
- }
- else
- {
- int gradeExcluded = numberOfInputs;
- Console.WriteLine($"{name} has been excluded at {gradeExcluded} grade");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement