Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reto 0 Java #14

Merged
merged 16 commits into from
Jan 2, 2023
28 changes: 28 additions & 0 deletions Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/java/MrHarvyson.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.example;

/*
* 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 MrHarvyson {
public static void main(String[] args) {

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);
}
}

}

}