tedo1111

Untitled

Jan 22nd, 2024
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. function spiceMustFlow(starting) {
  2.  
  3. let days = 0;
  4.  
  5. let spices = starting;
  6. let forWorkers = 26;
  7.  
  8. let totalSpices = 0;
  9. let totalYield = starting;
  10.  
  11. let forPeople = 0;
  12.  
  13. let finalResult = 0;
  14.  
  15.  
  16. forPeople = totalYield - 26;
  17. while (spices >= 100) {
  18.  
  19. totalSpices = spices - forWorkers;
  20. finalResult += totalSpices;
  21. totalYield = spices - 10;
  22. spices = totalYield;
  23.  
  24. days++;
  25. }
  26. let result = finalResult - 26;
  27.  
  28. console.log(days);
  29. console.log(result);
  30. }
  31. spiceMustFlow(111);
  32. // spiceMustFlow(450);
Tags: js
Advertisement
Add Comment
Please, Sign In to add comment