Advertisement
Spocoman

Online Education

Sep 23rd, 2023
986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. using System;
  2.  
  3. namespace OnlineEducation
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int onlineStudents = 0;
  10.             int onsiteStudents = 0;
  11.  
  12.             string educationForm;
  13.             int studentCount;
  14.  
  15.             for (int i = 0; i < 3; i++)
  16.             {
  17.                 educationForm = Console.ReadLine().ToLower();
  18.                 studentCount = int.Parse(Console.ReadLine());
  19.  
  20.                 if (educationForm == "online")
  21.                 {
  22.                     onlineStudents += studentCount;
  23.                 }
  24.                 else
  25.                 {
  26.                     onsiteStudents += studentCount;
  27.                 }
  28.             }
  29.  
  30.             if (onsiteStudents > 600)
  31.             {
  32.                 onlineStudents += onsiteStudents - 600;
  33.                 onsiteStudents = 600;
  34.             }
  35.  
  36.             Console.WriteLine($"Online students: {onlineStudents}");
  37.             Console.WriteLine($"Onsite students: {onsiteStudents}");
  38.             Console.WriteLine($"Total students: {onlineStudents + onsiteStudents}");
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement