-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4bf8b0d
commit 8277a95
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/go/ozkar503.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,28 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
) | ||
|
||
/* | ||
* 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". | ||
*/ | ||
func main() { | ||
for i := 1; i <= 100; i++ { | ||
if i%3 == 0 && i%5 == 0 { | ||
fmt.Println(strconv.Itoa(i) + " fizzbuzz") | ||
} else if i%3 == 0 { | ||
fmt.Println(strconv.Itoa(i) + " fizz") | ||
} else if i%5 == 0 { | ||
fmt.Println(strconv.Itoa(i) + " buzz") | ||
} else { | ||
fmt.Println(strconv.Itoa(i) + " ---") | ||
} | ||
} | ||
} |