#include
#include
int SeparatingDigits(int num);/function prototype/
int main(void){
int i, a;/*the integer*/
int n = 1;/*the number of times*/
int digits;/*separating digits*/
运行后说我用0除integer
printf("input the number i :");/obtain two integers from usser/
scanf_s("%d", &i);
/*separete the intger user input*/
digits = SeparatingDigits(i);
/*display the result*/
printf("the separated number :%d ", digits);
return 0;
}/*end main*/
int SeparatingDigits(int num){
int i, a;/*the integer*/
int n = 1;/*the number of times*/
int digits;/*separating digits*/
for (i = 1; i <= 32767; i++) {
a = i;
while (i > 9) {
i /= 10;
n *= 10;
}
while (n > 0) {
a %= n;
n /= 10;
}
return digits = a / n;
}
}/end the main/