Liliana797979

spice must flow - fundamentals

May 28th, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.      
  2. function solve(startingYield) {
  3.  
  4.     let result = 0;
  5.     let counter = 0;
  6.     while (startingYield >= 100) {
  7.         result += startingYield - 26;
  8.         if(result<26){
  9.            
  10.         }
  11.         startingYield -= 10;
  12.         counter++;
  13.         if (startingYield < 100) {
  14.             result -= 26;
  15.             if(result<26){
  16.                 result += 26;
  17.             }
  18.             console.log(counter);
  19.             console.log(result);
  20.             return;
  21.         }
  22.  
  23.     }
  24.     console.log(counter);
  25.     console.log(result);
  26.  
  27. }
  28. solve(99)
Advertisement
Add Comment
Please, Sign In to add comment