factorial.go

//Calcula el factorial de un numero. package main import "fmt" func main() { var numero uint fmt.Println("Introdusca un numero") fmt.Scanln(&numero) fmt.Println(factorial(numero)) } func factorial(numero uint) uint { if numero == 0 { return 1 } else { return numero * factorial(numero-1) } }

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.