Skip to content

Instantly share code, notes, and snippets.

@Abidzar16
Created January 6, 2021 06:21
Show Gist options
  • Save Abidzar16/bf235fed7a6b34979a46e6634e356363 to your computer and use it in GitHub Desktop.
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)
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