Created
January 6, 2021 06:21
-
-
Save Abidzar16/bf235fed7a6b34979a46e6634e356363 to your computer and use it in GitHub Desktop.
Jawaban untuk test backend 1 dengan menggunakan node.js, pola yang dipilih adalah gambar kiri atas (link soal : https://bit.ly/38fEUYT)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readline = require("readline").createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}); | |
readline.question("Insert a Number: ", (number) => { | |
for (i = 0; i < number; i++) { | |
a = 1; | |
b = 1; | |
c = 1; | |
if (i % 2 == 0){ | |
if (i % 4 == 0){c = number-2;} else {a = number-2;} | |
} else { | |
b = number-2; | |
} | |
var combinedString = "@".repeat(a) + " ".repeat(b) + "@".repeat(c); | |
console.log(combinedString); | |
} | |
readline.close(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment