Created
May 11, 2022 04:03
-
-
Save mralfarrakhan/c41ad2766c3ca5abf2547363e5ebd8cf to your computer and use it in GitHub Desktop.
integer to list of integer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func iparse( n int) []int { | |
| var res []int | |
| var dec int | |
| var par int | |
| pwr := 1 | |
| for i := 0; dec <= n; i++ { | |
| dec = pow(10, pwr) //pow(int, int) int func. | |
| par = 10*(n % dec)/dec | |
| res = append(res, par) | |
| pwr++ | |
| } | |
| return res | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment