Viktomirova

05._Exam_Preparation

Jun 14th, 2020
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _05._Exam_Preparation
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int students = int.Parse(Console.ReadLine());
  10.             int problems = int.Parse(Console.ReadLine());
  11.             int energy = int.Parse(Console.ReadLine());
  12.             int questions = 0;
  13.             int problemCounter = 0;
  14.  
  15.             while (students > 10)
  16.             {
  17.                 problemCounter += problems;
  18.                 energy += problems * 2;
  19.                 students -= problems;
  20.                 questions += students * 2;
  21.                 energy -= students * 2 * 3;
  22.                 if (energy <= 0)
  23.                 {
  24.                     Console.WriteLine("The trainer is too tired!");
  25.                     Console.WriteLine($"Questions asked: {questions}");
  26.                     return;
  27.                 }
  28.                 students += students / 10;
  29.             }
  30.             Console.WriteLine("The students are too few!");
  31.             Console.WriteLine($"Problems solved: {problemCounter}");
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment