2021 Day 7 Complete!

This commit is contained in:
2021-12-07 08:09:58 -06:00
parent dba8cc0e0f
commit 5b7a73e883
4 changed files with 98 additions and 0 deletions

View File

@@ -30,6 +30,23 @@ const (
SHRUG = "¯\\_(ツ)_/¯"
)
// Fact returns the factorial of the given int
func Fact(x int) int {
var ret int
for i := 0; i <= x; i++ {
ret += i
}
return ret
}
// Abs returns the absolute value of the given int
func Abs(x int) int {
if x < 0 {
return x * -1
}
return x
}
// Gcd Finds the greatest common denominator
func Gcd(x, y int) int {
for y != 0 {