silvana1303

renovation

Apr 28th, 2020
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 KB | None | 0 0
  1. using System;
  2.  
  3. namespace exampreparation
  4.  
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int wallHeight = int.Parse(Console.ReadLine());
  11.             int wallWidth = int.Parse(Console.ReadLine());
  12.             int percentNonPaint = int.Parse(Console.ReadLine());
  13.  
  14.             int wallsToPaint = wallHeight * wallWidth * 4;
  15.             double afterPercent = Math.Ceiling(wallsToPaint - wallsToPaint * (1.0 * percentNonPaint / 100));
  16.  
  17.             string command = Console.ReadLine();
  18.  
  19.             while (command != "Tired!")
  20.             {
  21.                 int paint = int.Parse(command);
  22.  
  23.                 afterPercent -= paint;
  24.  
  25.                 if (afterPercent <= 0)
  26.                 {
  27.                     break;
  28.                 }
  29.  
  30.                 command = Console.ReadLine();
  31.             }
  32.  
  33.          
  34.             if (afterPercent < 0)
  35.             {
  36.                 Console.WriteLine($"All walls are painted and you have {Math.Abs(afterPercent)} l paint left!");
  37.             }
  38.             else if(afterPercent == 0)
  39.             {
  40.                 Console.WriteLine($"All walls are painted! Great job, Pesho!");
  41.             }
  42.             else
  43.             {
  44.                 Console.WriteLine($"{afterPercent} quadratic m left.");
  45.             }
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment