Advertisement
sanyakasarova

05. Renovation

Aug 14th, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Exam_Prep
  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. double totalSpace = height * width * 4;
  14. totalSpace -= totalSpace * (percent / 100.00);
  15. totalSpace = Math.Ceiling(totalSpace); // !!!
  16.  
  17. string input = Console.ReadLine();
  18.  
  19. while (input != "Tired!")
  20. {
  21. int paintLiters = int.Parse(input); // 10
  22.  
  23. totalSpace -= paintLiters;
  24.  
  25. if (totalSpace == 0)
  26. {
  27. Console.WriteLine("All walls are painted! Great job, Pesho!");
  28. break;
  29. }
  30. else if (totalSpace < 0)
  31. {
  32. Console.WriteLine($"All walls are painted and you have {Math.Abs(totalSpace)} l paint left!" );
  33. break;
  34. }
  35.  
  36. input = Console.ReadLine();
  37. }
  38.  
  39. if (input == "Tired!")
  40. {
  41. Console.WriteLine($"{totalSpace} quadratic m left.");
  42. }
  43.  
  44. }
  45. }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement