Advertisement
spasnikolov131

Untitled

Jun 15th, 2022
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. using System;
  2. using System.Linq.Expressions;
  3.  
  4. namespace Add_Bags
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int hight = int.Parse(Console.ReadLine());
  11. int length = int.Parse(Console.ReadLine());
  12. int percentage = int.Parse(Console.ReadLine());
  13.  
  14. const int walls = 4;
  15. double totalCover = 0;
  16. double count = 0;
  17.  
  18. totalCover = hight * length * walls;
  19. totalCover -= totalCover * (percentage * 0.01);
  20.  
  21.  
  22.  
  23. while (true)
  24. {
  25. string line = Console.ReadLine();
  26.  
  27. if (line == "Tired!")
  28. {
  29. Console.WriteLine($"{totalCover} quadratic m left.");
  30. break;
  31. }
  32. count = int.Parse(line);
  33.  
  34. totalCover -= count;
  35. count++;
  36.  
  37. if (count > totalCover)
  38. {
  39. count -= totalCover;
  40.  
  41. Console.WriteLine($"All walls are painted and you have {count} l paint left!");
  42.  
  43. }
  44. else if (count == totalCover)
  45. {
  46. Console.WriteLine("All walls are painted! Great job, Pesho!");
  47. }
  48. }
  49.  
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement