Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// PSEUDOCODE
/*
FOR every number between 7 - 31
SET people equal to empty array

IF i divisible by 5
PUSH `Tempat fitness tutup` inside people
ELSE
IF i-7 divisible by 2
PUSH `Tono` inside people
IF i-7 divisible by 4
PUSH `Anton` inside people
IF i-7 divisible by 5
PUSH `Budi` inside people

DISPLAY `Tanggal i : join people using ','`

END LOOP
*/



function gym() {
for(var i = 7 ; i <= 31 ; i++){
let people = []

if(i % 5 == 0) {
people.push(`Tempat fitness tutup`)
} else {
if((i-7)% 2 == 0){
people.push(`Tono`)
}
if((i-7) % 4 == 0) {
people.push(`Anton`)
}
if ((i-7) % 5 == 0) {
people.push(`Budi`)
}
}
console.log(`Tanggal ${i} : ${people.join(',')}`)
}
}
gym()