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

Solucion Reto #0 Java #1282

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions app/src/main/java/com/mouredev/weeklychallenge2022/Challenge0.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,18 @@ package com.mouredev.weeklychallenge2022
* - Subiré una posible solución al ejercicio el lunes siguiente al de su publicación.
*
*/

fun main() {

for (index in 1..100) {
val divisibleByThree = index % 3 == 0
val divisibleByFive = index % 5 == 0
if (divisibleByThree && divisibleByFive) {
println("fizzbuzz")
} else if (divisibleByThree) {
println("fizz")
} else if (divisibleByFive) {
println("buzz")
} else {
println(index)
}
public class Challenge0 {
public static void main(){
for(int i = 1; i<=100;i++){
if(i%3 == 0){
System.out.println(i + ": fizz");
} else if(i%5 == 0){
System.out.println(i + ": buzz");
} else if (i%3 == 0 && i%5 == 0){
System.out.println(i + ": fizzbuzz");
} else {
System.out.println(i + ":");
}
}
}
}
}