Guest User

05. Suitcases Load

a guest
Aug 19th, 2020
178
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 _05.SuitcasesLoad
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double trynkCapacity = double.Parse(Console.ReadLine());
  10.             string suitcaseVolume = Console.ReadLine();
  11.  
  12.             int counterOfSuitcases = 0;
  13.  
  14.  
  15.             while (suitcaseVolume != "End")
  16.             {
  17.                 double input = double.Parse(suitcaseVolume);
  18.  
  19.                 if (trynkCapacity <= input)
  20.                 {
  21.                     Console.WriteLine("No more space!");
  22.                     break;
  23.                 }
  24.  
  25.                 trynkCapacity -= input;
  26.                 counterOfSuitcases++;
  27.  
  28.                 if (counterOfSuitcases % 3 == 0)
  29.                 {
  30.                     input += input * 0.10;
  31.                 }
  32.  
  33.                 suitcaseVolume = Console.ReadLine();
  34.             }
  35.  
  36.             if (suitcaseVolume == "End")
  37.             {
  38.                 Console.WriteLine("Congratulations! All suitcases are loaded!");
  39.             }
  40.  
  41.             Console.WriteLine($"Statistic: {counterOfSuitcases} suitcases loaded.");
  42.         }
  43.     }
  44. }
  45.  
Add Comment
Please, Sign In to add comment