#include?
#include?
#include?
void?print_num(long?number);
print_num(123456);
p>return?1;
}
void?print_num(long?number)?{
int?digits?=?floor(log10 (abs(number)))?+?1;?//?Find the number of digits in an integer
int?array[digits];
int?i?=?digits? -?1;
while?(number)?{ //?Extract each digit (starting with the ones digit) and store it in the array
array[i]?=?number? %?10;
number?/=?10;
i--;
}
for?(i?= ?0;?i?
if?(i?==?digits?-?1)
< p> printf("%d",?array[i]);//?The last number does not need to be separated by commaselse?
printf("%d,?" ,?array[i]);
}
}
The output result is: