package main

import (
	"fmt"
)
// n! = n * (n-1) * (n-2)...* 2 * 1
// code limited to return value based
// int type interger range
func factorial(num int) int {
        if num == 0 {
            return 1
        }
	f := num
	for i:=num; i>=3; i-- {
		f = f * (i - 1)
	}
	return f
}

func main() {
	// Dn't used value beyond int type integer range
	fmt.Println("Factorial:",factorial(20))
}
package main

import "fmt"

// n! = n * (n-1) * (n-2)...* 2 * 1
// code limited to return value based
// int type interger range
// Recursive function
func fact(n int) int {
// terminate the loop with return
	if n == 0 {
		return 1
	}
// return call fact() function is recursively repeteatly 
	return n * fact(n - 1)
}

func main() {
	fmt.Println(fact(5))
}