Skip to content

Commit

Permalink
Merge branch 'mouredev:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
JorgeToT authored Jan 2, 2023
2 parents f6d368f + 2b62876 commit 904cf13
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
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);
}
}
}
}
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 Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/kotlin/melegit.kt
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()
}
}
9 changes: 9 additions & 0 deletions Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/3cko0.py
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 Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/LakerGarcia.py
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 Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/typescript/JvegaG.ts
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)}`)
}

0 comments on commit 904cf13

Please sign in to comment.