You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-algorithms/numerical/factorial.go

17 lines
205 B
Go

package main
import "fmt"
func factorial(num int) int {
if num == 0 {
return 1
}
return num * factorial(num - 1)
}
func main() {
num := 10
result := factorial(num)
fmt.Println(result)
}