2021 Day 7 Complete!
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user