Advertisement
kstoyanov

01. SoftUni Reception js mid exam

Jul 5th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function exam(args) {
  2.   let studentsCount = Number(args.pop());
  3.   const [emp1, emp2, emp3] = args.map(Number);
  4.  
  5.   let timeNeeded = 0;
  6.  
  7.   while (studentsCount > 0) {
  8.     timeNeeded++;
  9.  
  10.     if (timeNeeded % 4 !== 0) {
  11.       studentsCount -= emp1;
  12.       studentsCount -= emp2;
  13.       studentsCount -= emp3;
  14.     }
  15.   }
  16.   console.log(`Time needed: ${timeNeeded}h.`);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement