Advertisement
Liliana797979

care of puppy

Feb 1st, 2021
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function careOfPuppy(input) {
  2.     let food = Number(input[0]);
  3.     let totalFood = 0;
  4.  
  5.     let foodInGrams = food * 1000;
  6.     totalFood = 130 + 345 + 400 + 180 + 230 + 120;
  7.    
  8.     for (i = 1; i === "Adopted"; i ++) {
  9.     }
  10.     if (foodInGrams >= totalFood) {
  11.         console.log(`Food is enough! Leftovers: ${(foodInGrams - totalFood)} grams.`);
  12.     } else {
  13.         console.log(`Food is not enough. You need ${(totalFood - foodInGrams)} grams more.`);
  14.     }
  15. }
  16.  
  17. careOfPuppy(["4", "130", "345", "400", "180", "230", "120", "Adopted"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement