Advertisement
nikolayneykov

Untitled

Oct 7th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _02.Graduation
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string Name = Console.ReadLine();
  14.             double grades = 1;
  15.             double sum = 0;
  16.  
  17.             while (grades <= 12)
  18.             {
  19.                 double grade = double.Parse(Console.ReadLine());
  20.  
  21.                 if (grade >= 4.00)
  22.                 {
  23.                     sum = sum + grade;
  24.                     grades++;
  25.                 }
  26.                    
  27.             }
  28.             double average = sum / 12;
  29.  
  30.  
  31.             Console.WriteLine($"{Name} graduated. Average grade: {average:F2}");
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement