fizzbuzz.go

package main import "fmt" func fizzbuzz(numero int) { for i := 1; i <= numero; i++ { if i%5 == 0 && i%3 == 0 { fmt.Println("FizzBuzz") } else if i%3 == 0 { fmt.Println("Fizz") } else if i%5 == 0 { fmt.Println("Buzz") } else { fmt.Println(i) } } } func main() { var numero int fmt.Println("Ingresa un numero:") fmt.Scanln(&numero) fizzbuzz(numero) }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.