Skip to content

Instantly share code, notes, and snippets.

@yonisetiawan
Created January 12, 2017 08:46
Show Gist options
  • Save yonisetiawan/b03ccda1e2694d380c07899851c5a91c to your computer and use it in GitHub Desktop.
Save yonisetiawan/b03ccda1e2694d380c07899851c5a91c to your computer and use it in GitHub Desktop.
LiveCoading Hacktiv8 Soal 1
function deretBilangan(input) {
var arr = []
for (var i = 1; i <= input; i++) {
arr.push(i * 3)
}
for (var i = 0; i < arr.length; i++) {
if (arr[i] % 5 == 0 && arr[i] % 6 == 0) {
arr[i] = "KASKUS"
} else if (arr[i] % 5 == 0) {
arr[i] = "KAS"
} else if (arr[i] % 6 == 0) {
arr[i] = "KUS"
}
}
console.log(arr);
}
deretBilangan(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment