Created
October 15, 2017 15:58
-
-
Save avelino/2266fc463ac021af99cb85664f2627b1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package main | |
import "fmt" | |
func fact(n int) int { | |
if n == 0 { | |
return 1 | |
} | |
return n * fact(n-1) | |
} | |
func main() { | |
t := 0 | |
for j := 0; j < 100000; j++ { | |
for i := range []int{1, 2, 3, 4, 5, 6, 7, 8} { | |
t += fact(i) | |
} | |
} | |
fmt.Println("total: ", t) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment