Advertisement
AlexTasev

OnlineEducation

Apr 28th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _3_OnlineEducation
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             string firstStage = Console.ReadLine();
  10.             int firstCount = int.Parse(Console.ReadLine());
  11.             string secondStage = Console.ReadLine();
  12.             int secondCount = int.Parse(Console.ReadLine());
  13.             string thirdStage = Console.ReadLine();
  14.             int thirdCount = int.Parse(Console.ReadLine());
  15.  
  16.             int online = 0;
  17.             int onsite = 0;
  18.  
  19.             if (firstStage == "online")
  20.             {
  21.                 online += firstCount;
  22.             }
  23.             else if (firstStage == "onsite")
  24.             {
  25.                 onsite += firstCount;
  26.             }
  27.  
  28.             if (secondStage == "online")
  29.             {
  30.                 online += secondCount;
  31.             }
  32.             else if (secondStage == "onsite")
  33.             {
  34.                 onsite += secondCount;
  35.             }
  36.  
  37.             if (thirdStage == "online")
  38.             {
  39.                 online += thirdCount;
  40.             }
  41.             else if (thirdStage == "onsite")
  42.             {
  43.                 onsite += thirdCount;
  44.             }
  45.  
  46.             if (onsite > 600)
  47.             {
  48.                 online += onsite - 600;
  49.                 onsite = 600;
  50.             }
  51.  
  52.             int total = online + onsite;
  53.  
  54.             Console.WriteLine($"Online students: {online}");
  55.             Console.WriteLine($"Onsite students: {onsite}");
  56.             Console.WriteLine($"Total students: {total}");
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement