题解 | #绝对值#
绝对值
https://www.nowcoder.com/practice/288815f39cd54b908eed6eae65d69f84
使用math包中的func Abs(x float64) float64 函数取绝对值
package main
import "math"
func absfunc( x int ) int {
// write code here
// if x < 0 {
// return -x
// }
i := math.Abs(float64(x))
return int(i)
}
