Advertisement
svephoto

Graduation [C#]

Nov 29th, 2019
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Graduation
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string name = Console.ReadLine();
  10.             double average = 0;
  11.             int marksCount = 1;
  12.  
  13.             while (marksCount <= 12)
  14.             {
  15.                 double input = double.Parse(Console.ReadLine());
  16.  
  17.                 if (input >= 4.00)
  18.                 {
  19.                     average += input;
  20.                     marksCount++;
  21.                 }
  22.             }
  23.  
  24.             average /= 12;
  25.  
  26.             Console.WriteLine($"{name} graduated. Average grade: {average:f2}");
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement