Skip to content

Instantly share code, notes, and snippets.

@mralfarrakhan
Created May 11, 2022 04:03
Show Gist options
  • Select an option

  • Save mralfarrakhan/c41ad2766c3ca5abf2547363e5ebd8cf to your computer and use it in GitHub Desktop.

Select an option

Save mralfarrakhan/c41ad2766c3ca5abf2547363e5ebd8cf to your computer and use it in GitHub Desktop.
integer to list of integer
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