Liliana797979

national court with for - mid exam fundamentals

Jun 30th, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function nationalCourt(arr) {
  2.    
  3.     let answersPerHour = Number(arr[0]) + Number(arr[1]) + Number(arr[2]);
  4.     let peopleCount = Number(arr[3]);
  5.     let hours = 0;
  6.  
  7.  
  8.     for (let i = 0; i < peopleCount; i += answersPerHour) {
  9.         hours++;
  10.         if (hours % 4 == 0){
  11.             hours++;
  12.         }
  13.     }
  14.     console.log(`Time needed: ${hours}h.`);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment