SHARE
TWEET

Untitled

desislavg May 12th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace schoolEnd
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string name = Console.ReadLine();
  10.             int count = 0;
  11.             double sum = 0.0;
  12.             double average = 0.0;
  13.  
  14.             while (true)
  15.             {
  16.                 double num = double.Parse(Console.ReadLine());
  17.                 sum = sum + num;
  18.                 count++;
  19.                     if (count == 12)
  20.  
  21.                     {
  22.                         average = sum / count;
  23.                         if (average > 4 && average<= 6)
  24.                         {
  25.  
  26.                             Console.WriteLine($"{name} graduated. Average grade: {average:f2}");
  27.                         break;
  28.                         }
  29.                     else if ( average <4)
  30.                     {
  31.                         break;
  32.                     }
  33.                 }    
  34.             }
  35.         }
  36.     }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top