Advertisement
Valantina

Renovation/Exam

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