Advertisement
didito33

Attempt2

Feb 19th, 2023
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CookieFactory
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. int biscuits = int.Parse(Console.ReadLine());
  11. int workersCount = int.Parse(Console.ReadLine());
  12. int competingFactoryBiscuits = int.Parse(Console.ReadLine());
  13. double productionPerDay = 0;
  14. double totalProduction = 0;
  15. double biscuitsPerThreeDays = 0;
  16. for (int i = 1; i <= 30; i++)
  17. {
  18.  
  19. if (i % 3 == 0)
  20. {
  21. biscuitsPerThreeDays = biscuits * workersCount;
  22. biscuitsPerThreeDays *= 0.75;
  23. productionPerDay += biscuitsPerThreeDays;
  24. }
  25. else
  26. {
  27. productionPerDay = biscuits * workersCount;
  28. }
  29. totalProduction += productionPerDay;
  30. productionPerDay = 0;
  31.  
  32. }
  33. Console.WriteLine($"You have produced {totalProduction} biscuits for the past month.");
  34. double difference = 0;
  35. if(totalProduction < competingFactoryBiscuits)
  36. {
  37. difference = competingFactoryBiscuits - totalProduction;
  38. Console.WriteLine($"You produce {(difference/competingFactoryBiscuits*100):F2} percent less biscuits.");
  39. }
  40. else
  41. {
  42. difference = totalProduction - competingFactoryBiscuits;
  43. Console.WriteLine($"You produce {(difference/competingFactoryBiscuits*100):F2} percent more biscuits.");
  44. }
  45.  
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement