Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mouredev committed Jan 2, 2023
2 parents 6d492f4 + 49c4203 commit d228e1b
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 28 deletions.
14 changes: 0 additions & 14 deletions Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/dart/bushi.dart

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
void main() {
_fizzbuzz();
}

void _fizzbuzz() {
for (var i = 1; i <= 100; i++) {
if (i % 3 == 0 && i % 5 == 0) {
print("fizzbuzz\n");
}
else if (i % 3 == 0) {
print("fizz\n");
}
else if (i % 5 == 0) {
print("buzz\n");
} else {
print("$i\n");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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".
*/

for (let i = 1; i <= 100; i++) {
if (i % 15 == 0) console.log("FizzBuzz");
else if (i % 3 == 0) console.log("Fizz");
else if (i % 5 == 0) console.log("Buzz");
else console.log(i);
}
14 changes: 0 additions & 14 deletions Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/kotlin/bushi.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
fun main() {
fizzbuzz()
}

private fun fizzbuzz() {
for (i in 1..100) {
if (i % 3 == 0 && i % 5 == 0) {
println("fizzbuzz")
} else if (i % 3 == 0) {
println("fizz")
} else if (i % 5 == 0) {
println("buzz")
} else {
println(i)
}
}
}
31 changes: 31 additions & 0 deletions Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/php/kevocde.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* Challenge #0 - The famous Fizz Buzz
*/
const LIMITS = [1, 100];

/**
* Prints the fizz buzz sequence
*
* @param int $from
* @param int $until
* @return void
*/
function printFizzBuzzSequence($from, $until) {
for ($i = $from; $i <= $until; $i ++) {
// First determinates if the number is multiple of
$isThreeMultiple = ($i % 3) === 0;
$isFiveMultiple = ($i % 5) === 0;

// Second generates a string and prints
echo implode([
$isThreeMultiple ? 'fizz' : '',
$isFiveMultiple ? 'buzz' : '',
($isThreeMultiple || $isFiveMultiple) ? '' : $i
]);

echo "\n";
}
}

printFizzBuzzSequence(...LIMITS);

0 comments on commit d228e1b

Please sign in to comment.