We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c5511ec commit e83bb3eCopy full SHA for e83bb3e
1 file changed
Interview-Questions/fizzbuzz.js
@@ -0,0 +1,18 @@
1
+function fizzBuzz(n) {
2
+ for (let i = 1; i <= n; i++) {
3
+ if (i % 3 === 0 && i % 5 === 0) {
4
+ console.log("FizzBuzz");
5
+ } else if (i % 3 === 0) {
6
+ console.log("Fizz");
7
+ } else if (i % 5 === 0) {
8
+ console.log("Buzz");
9
+ } else {
10
+ console.log(i);
11
+ }
12
13
+}
14
+
15
+function main() {
16
+ const n = parseInt(readLine().trim(), 10);
17
+ fizzBuzz(n);
18
0 commit comments