12345678910111213141516171819202122 |
- package kata
- import "strconv"
- func fact(n int) int {
- if n <= 1 {
- return 1
- }
- return n * fact(n - 1)
- }
- func Strong(n int) string {
- s := strconv.Itoa(n)
- fSum := 0
- for _, r := range s {
- fSum += fact(int(r - '0'))
- }
- if fSum == n {
- return "STRONG!!!!"
- }
- return "Not Strong !!"
- }
|