package main
import (
"fmt"
"sort"
"strconv"
)
func sortDigitsOfNumberAscending(num int) int {
// Convert the number to a string
numStr := strconv.Itoa(num)
// Convert the string to a slice of runes
digits := []rune(numStr)
// Sort the slice of runes
sort.Slice(digits, func(i, j int) bool {
return digits[i] < digits[j]
})
// Convert the sorted slice to string
sortedStr := string(digits)
// Convert the string to integer
sortedNumber, _ := strconv.Atoi(sortedStr)
return sortedNumber
}
func main() {
num := 94352
sortedNumber := sortDigitsOfNumberAscending(num)
fmt.Println("Sorted number:", sortedNumber)
}
/*
run:
Sorted number: 23459
*/