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 branch 'mouredev:main' into main
- Loading branch information
Showing
826 changed files
with
32,405 additions
and
98 deletions.
There are no files selected for viewing
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
43 changes: 43 additions & 0 deletions
43
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/c#/ernestoalbarez.cs
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,43 @@ | ||
using System; | ||
|
||
/* | ||
Reto #0: EL FAMOSO "FIZZ BUZZ" | ||
* 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". | ||
*/ | ||
|
||
|
||
class Program | ||
{ | ||
static void Main() | ||
{ | ||
string fizz = "Fizz"; | ||
string buzz = "Buzz"; | ||
string fizzBuzz = "FizzBuzz"; | ||
|
||
for (int i=1; i<=100; i++) | ||
{ | ||
bool divisibleBy3 = i%3==0; | ||
bool divisibleBy5 = i%5==0; | ||
|
||
if (divisibleBy3 && divisibleBy5) { | ||
Console.WriteLine(fizzBuzz); | ||
} | ||
else if (divisibleBy3) { | ||
Console.WriteLine(fizz); | ||
} | ||
else if (divisibleBy5) { | ||
Console.WriteLine(buzz); | ||
} | ||
else { | ||
Console.WriteLine(i); | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
using System; | ||
|
||
for (int i = 1; i <= 100; i++) | ||
{ | ||
Console.WriteLine( | ||
i % 3 == 0 && i % 5 == 0 ? "fizzbuzz" : | ||
i % 3 == 0 ? "fizz" : | ||
i % 5 == 0 ? "buzz" | ||
: $"{i}" | ||
); | ||
} |
18 changes: 18 additions & 0 deletions
18
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/c++/6d61726b.cpp
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 @@ | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
for (short i = 1; i <= 100; i++) | ||
{ | ||
if (i % 3 == 0 && i % 5 == 0) | ||
std::cout << "fizzbuzz" << std::endl; | ||
else if (i % 3 == 0) | ||
std::cout << "fizz" << std::endl; | ||
else if (i % 5 == 0) | ||
std::cout << "buzz" << std::endl; | ||
else | ||
std::cout << i << std::endl; | ||
} | ||
|
||
return 0; | ||
} |
41 changes: 41 additions & 0 deletions
41
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/c++/ernestoalbarez.cpp
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,41 @@ | ||
#include <iostream> | ||
#include <string> | ||
|
||
/* | ||
Reto #0: EL FAMOSO "FIZZ BUZZ" | ||
* 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". | ||
*/ | ||
|
||
int main() | ||
{ | ||
std::string fizz = "Fizz"; | ||
std::string buzz = "Buzz"; | ||
std::string fizzBuzz = "FizzBuzz"; | ||
|
||
for (int i = 1; i <= 100; i++) { | ||
bool divisibleBy3 = i % 3 == 0; | ||
bool divisibleBy5 = i % 5 == 0; | ||
|
||
if (divisibleBy3 && divisibleBy5) { | ||
std::cout << fizzBuzz << std::endl; | ||
} | ||
else if (divisibleBy3) { | ||
std::cout << fizz << std::endl; | ||
} | ||
else if (divisibleBy5) { | ||
std::cout << buzz << std::endl; | ||
} | ||
else { | ||
std::cout << i << std::endl; | ||
} | ||
} | ||
|
||
return 0; | ||
} |
11 changes: 11 additions & 0 deletions
11
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/c++/pyramsd.cpp
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 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(){ | ||
for (int i = 0; i <= 100; i++){ | ||
if (i % 3 == 0 && i % 5 == 0) cout << "fizzbuzz" << endl; | ||
else if (i % 3 == 0) cout << "fizz" << endl; | ||
else if (i % 5 == 0) cout << "buzz" << endl; | ||
else cout << i << endl; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/c++/ronnyg2121.cpp
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,26 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
// Solución al ejercicio #0 | ||
for (int i = 0; i < 101; i++) { | ||
if (i %3 == 0 && i %5 == 0) { | ||
cout << "fizzbuzz\n" << endl; | ||
} | ||
|
||
else if (i %3 == 0) { | ||
cout << "fizz\n" << endl; | ||
} | ||
|
||
else if(i %5 == 0) { | ||
cout << "buzz\n" << endl; | ||
} | ||
|
||
else { | ||
cout << i << endl; | ||
} | ||
} | ||
|
||
return 0; | ||
} |
35 changes: 35 additions & 0 deletions
35
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/c/ernestoalbarez.c
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,35 @@ | ||
#include <stdio.h> | ||
#include <stdbool.h> | ||
|
||
/* | ||
Reto #0: EL FAMOSO "FIZZ BUZZ" | ||
* 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". | ||
*/ | ||
|
||
void main() { | ||
const char* fizz = "Fizz"; | ||
const char* buzz = "Buzz"; | ||
const char* fizzBuzz = "FizzBuzz"; | ||
|
||
for (int i=1; i<=100; i++) { | ||
bool divisibleBy3 = i%3==0; | ||
bool divisibleBy5 = i%5==0; | ||
|
||
if (divisibleBy3 && divisibleBy5) { | ||
puts(fizzBuzz); | ||
} else if (divisibleBy3) { | ||
puts(fizz); | ||
} else if (divisibleBy5) { | ||
puts(buzz); | ||
} else { | ||
printf("%d\n", i); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/c/juangonzalezdla.c
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 @@ | ||
#include <stdio.h> | ||
|
||
int main() | ||
{ | ||
for(int n = 1; n <= 100; n++) { | ||
if (n % 3 == 0 && n % 5 == 0) { | ||
printf("%d fizzbuzz\n", n); | ||
} else if (n % 3 == 0) { | ||
printf("%d fizz\n", n); | ||
} else if (n % 5 == 0) { | ||
printf("%d buzz\n", n); | ||
} else { | ||
printf("%d\n", n); | ||
} | ||
} | ||
|
||
return 0; | ||
} |
10 changes: 10 additions & 0 deletions
10
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/dart/AnzurezDev.dart
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,10 @@ | ||
void main() { | ||
fizzBuzz(); | ||
} | ||
|
||
void fizzBuzz() { | ||
for ( int index=1; index<=100; index++ ) { | ||
String output = ( index % 3 ==0 ? "fizz" : "" ) + ( index % 5 ==0 ? "buzz" : ""); | ||
print( output.isEmpty ? index : output ); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/dart/amandabrodriguez.dart
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,24 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
void main() { | ||
for (var i = 0; i <= 100; i++) { | ||
if (i == 0) { | ||
print(0); | ||
} else if (i % 3 == 0 && i % 5 == 0) { | ||
print("fizzbuzz"); | ||
} else if (i % 3 == 0) { | ||
print("fizz"); | ||
} else if (i % 5 == 0) { | ||
print("buzz"); | ||
} else { | ||
print(i); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/go/josevalver.go
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,19 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
for i := 1; i <= 100; i++ { | ||
if i%3 == 0 { | ||
fmt.Println("fizz") | ||
} else if i%5 == 0 { | ||
fmt.Println("buzz") | ||
} else if i%3 == 0 && i%5 == 0 { | ||
fmt.Println("fizzbuzz") | ||
} else { | ||
fmt.Println(i) | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/java/AnzurezDev.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,12 @@ | ||
public class AnzurezDev { | ||
public static void main( String args[] ) { | ||
fizzBuzz(); | ||
} | ||
|
||
public static void fizzBuzz() { | ||
for ( int index=1; index<=100; index++ ) { | ||
String output = ( index % 3==0 ? "fizz" : "" ) + ( index % 5==0 ? "buzz" : "" ); | ||
System.out.println( output.isEmpty() ? index : output ); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/java/EnLoerDEV.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 @@ | ||
package Main; | ||
public class Main { | ||
public static void main(String[] args) { | ||
for(int i=1;i<101;i++){ | ||
if(i%15 == 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); | ||
} | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/java/alvaruncio.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,24 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
public class alvaruncio{ | ||
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); | ||
} | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/java/asjordi.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,26 @@ | ||
public class asjordi { | ||
|
||
public static void main(String[] args) { | ||
|
||
for (int i = 1; i <= 100; i++) { | ||
|
||
if (i % 3 == 0 && i % 5 == 0) { | ||
System.out.println("fizzbuzz"); | ||
continue; | ||
} | ||
|
||
if (i % 3 == 0) { | ||
System.out.println("fizz"); | ||
continue; | ||
} | ||
|
||
if (i % 5 == 0) { | ||
System.out.println("buzz"); | ||
continue; | ||
} | ||
|
||
System.out.println(i); | ||
} | ||
} | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/java/bramenn.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,19 @@ | ||
class Bramenn { | ||
public static void main(String[] args) { | ||
fizzBuzz(); | ||
} | ||
|
||
public static void fizzBuzz() { | ||
for (int i = 1; i <= 100; 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); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.