From 83ddb51365db8d3e975de3b97bd0d5828d43f796 Mon Sep 17 00:00:00 2001 From: Josa Vicente Date: Tue, 27 Dec 2022 15:19:07 +0100 Subject: [PATCH 1/2] Reto 0 - FizzBuzz - josavicente - Kotlin --- .../kotlin/josavicente.kt" | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 "Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [F\303\241cil]/kotlin/josavicente.kt" diff --git "a/Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [F\303\241cil]/kotlin/josavicente.kt" "b/Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [F\303\241cil]/kotlin/josavicente.kt" new file mode 100644 index 0000000000..05167a9300 --- /dev/null +++ "b/Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [F\303\241cil]/kotlin/josavicente.kt" @@ -0,0 +1,12 @@ +fun main(args: Array) { + for(index: Int in 1..50){ + println(fizzbuzzGenerator(index)) + } +} + +fun fizzbuzzGenerator(number: Int): String { + if ((number % 3 == 0) && (number % 5 == 0)) return "fizzbuzz" + if (number % 3 == 0) return "fizz" + if (number % 5 == 0) return "buzz" + return number.toString() +} \ No newline at end of file From 6454a6587902ea52f28c6d9e957fc3f8b08b817b Mon Sep 17 00:00:00 2001 From: Josa Vicente Date: Tue, 27 Dec 2022 16:43:27 +0100 Subject: [PATCH 2/2] Reto 0 - FizzBuzz - josavicente - Rust --- .../rust/josavicente.rs" | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 "Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [F\303\241cil]/rust/josavicente.rs" diff --git "a/Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [F\303\241cil]/rust/josavicente.rs" "b/Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [F\303\241cil]/rust/josavicente.rs" new file mode 100644 index 0000000000..8d60576fbb --- /dev/null +++ "b/Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [F\303\241cil]/rust/josavicente.rs" @@ -0,0 +1,15 @@ +fn main() { + for number in 1..=100{ + let mut text : String = number.to_string(); + if number % 3 == 0 && number % 5 == 0 { + text = "fizzbuzz".to_string(); + } + if number % 3 == 0 { + text = "fizz".to_string(); + } + if number % 5 == 0 { + text = "buzz".to_string(); + } + println!("{text}") + } +} \ No newline at end of file