forked from mouredev/retos-programacion-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mouredev#6476 from adaviladev/main
Reto #0 - Javascript
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/javascript/adaviladev.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// let number = 0; | ||
|
||
// while (number < 100) { | ||
// number++; | ||
// if (number % 3 === 0 && number % 5 === 0) { | ||
// console.log("fizzbuzz"); | ||
// } else if (number % 3 === 0) { | ||
// console.log("fizz"); | ||
// } else if (number % 5 === 0) { | ||
// console.log("buzz"); | ||
// } else { | ||
// console.log(number); | ||
// } | ||
// } | ||
|
||
const fizz = "fizz"; | ||
const buzz = "buzz"; | ||
|
||
for (let i = 1; i <= 100; i++) { | ||
if (i % 3 === 0 && i % 5 === 0) { | ||
console.log(fizz + buzz); | ||
} else if (i % 3 === 0) { | ||
console.log(fizz); | ||
} else if (i % 5 === 0) { | ||
console.log(buzz); | ||
} else { | ||
console.log(i); | ||
} | ||
} |