-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mouredev:main' into main
- Loading branch information
Showing
6 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/java/carSneider99.java
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,16 @@ | ||
public class carSneider99 { | ||
|
||
public static void main (String[] args){ | ||
for (int i=1; i<101; i++){ | ||
if (i%3 == 0 && i%5 == 0) { | ||
System.out.println("fizzbuzz"); | ||
} else if (i%3 == 0) { | ||
System.out.println("fizz"); | ||
} else if (i%5 == 0) { | ||
System.out.println("buzz"); | ||
} else { | ||
System.out.println(i); | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/kotlin/hgarciaalberto.kts
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,21 @@ | ||
/** | ||
""" | ||
RETO #0 | ||
Escribe un programa que muestre por consola (con un print) los | ||
números de 1 a 100 (ambos incluidos y con un salto de línea entre | ||
cada impresión), sustituyendo los siguientes: | ||
- Múltiplos de 3 por la palabra "fizz". | ||
- Múltiplos de 5 por la palabra "buzz". | ||
- Múltiplos de 3 y de 5 a la vez por la palabra "fizzbuzz". | ||
*/ | ||
|
||
(1..100).forEach { | ||
when { | ||
(it % 3) == 0 && (it % 5) == 0 -> "fizzbuzz" | ||
(it % 5) == 0 -> "buzz" | ||
(it % 3) == 0 -> "fizz" | ||
else -> it | ||
}.let { | ||
println(it) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/kotlin/melegit.kt
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,11 @@ | ||
fun main() { | ||
(1..100).forEach { num -> | ||
when { | ||
num % 3 == 0 && num % 5 == 0 -> println("FizzBuzz") | ||
num % 3 == 0 -> println("Fizz") | ||
num % 5 == 0 -> println("Buzz") | ||
else -> println(num) | ||
} | ||
println() | ||
} | ||
} |
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,9 @@ | ||
for x in range(1, 101): | ||
if x % 3 == 0 and x % 5 == 0: | ||
print("FizzBuzz") | ||
elif x % 3 == 0: | ||
print("Fizz") | ||
elif x % 5 == 0: | ||
print("Buzz") | ||
else: | ||
print(x) |
18 changes: 18 additions & 0 deletions
18
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/LakerGarcia.py
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,18 @@ | ||
#Solucion FIZZ BUZZ - Reto 0 | ||
|
||
for fizz_buzz in range(1, 101): | ||
|
||
if fizz_buzz % 15 == 0: | ||
print("FizzBuzz") | ||
continue | ||
|
||
elif fizz_buzz % 3 == 0: | ||
print("Fizz") | ||
continue | ||
|
||
elif fizz_buzz % 5 == 0: | ||
print("Buzz") | ||
continue | ||
|
||
|
||
print(fizz_buzz) |
23 changes: 23 additions & 0 deletions
23
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/typescript/JvegaG.ts
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,23 @@ | ||
/* | ||
* Escribe un programa que muestre por consola (con un print) los | ||
* números de 1 a 100 (ambos incluidos y con un salto de línea entre | ||
* cada impresión), sustituyendo los siguientes: | ||
* - Múltiplos de 3 por la palabra "fizz". | ||
* - Múltiplos de 5 por la palabra "buzz". | ||
* - Múltiplos de 3 y de 5 a la vez por la palabra "fizzbuzz". | ||
*/ | ||
|
||
export const fizzBuzzFunction = (value: number): string => { | ||
if( value % 3 === 0 && value % 5 === 0) | ||
return `fizzbuzz`; | ||
else if (value % 3 === 0) | ||
return `fizz`; | ||
else if (value % 5 === 0) | ||
return `buzz`; | ||
else | ||
return `${value}`; | ||
} | ||
|
||
for (let i = 1; i <= 100; i++) { | ||
console.log(`${fizzBuzzFunction(i)}`) | ||
} |