1
0
mirror of https://github.com/MADTeacher/go_basics.git synced 2025-11-23 21:34:47 +02:00
Files
go_basics/part_2/2.1/2.1.7/2.go
2025-05-28 14:52:05 +03:00

24 lines
414 B
Go

package main
import (
"fmt"
"math"
)
type MyPow func(value int) int
func degree(degree int) MyPow {
return func(value int) int {
return int(math.Pow(float64(value), float64(degree)))
}
}
func main() {
calculation := degree(3)
fmt.Println(calculation(3)) // 27
fmt.Println(calculation(4)) // 64
calculation = degree(9)
fmt.Println(calculation(4)) // 262144
fmt.Println(calculation(7)) // 40353607
}