-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaward_bonuses.js
43 lines (33 loc) · 1.12 KB
/
award_bonuses.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Totally Not Another FizzBuzz
Scrimba CEO Per Borgen wants you to write a program to grant special bonuses to all his employees based on their employee ID numbers!
Scrimba has 100 employees and their employee ID numbers range from 1 - 100. If the employee's ID number is:
Divisible by 3 - Vacation!
Divisible by 5 - $100,000 bonus!
Divisible by both 3 and 5 - JACKPOT! 1 Million and a Yacht!
Not divisible by 3 or 5 - :(
Write a program to loop through all the ID numbers and print their prize.
Your function's output should look something like this:
1 - :(
2 - :(
3 - Vacation!
4 - :(
5 - $100,000 bonus!
*/
// take input from user about employee id
function awardBonus() {
for (let i = 1; i <= 100; i++) {
if (i % 3 == 0) {
console.log(`${i} - Vacation!`);
}
if (i % 5 == 0) {
console.log(`${i} - $100,000 bonus!`);
}
if (i % 3 == 0 && i % 5 == 0) {
console.log(`${i} - JACKPOT! 1 Million and a Yacht!`);
}
if (i % 3 != 0 && i % 5 != 0) {
console.log(`${i} - :(`);
}
}
}
console.log(awardBonus());