解题思路:
注意事项:
参考代码:
#include <stdio.h> int main() { int inputNum,numArr[5],length; scanf("%5d",&inputNum); if (inputNum / 10 > 0) { if(inputNum / 100 > 0) { if(inputNum / 1000 > 0){ if(inputNum / 10000 >0){ if(inputNum / 100000 > 0){ printf("input number too large: %d", inputNum); return 1; } else { length = 5; } } else { length = 4; } } else { length =3; } } else { length = 2; } }else { length = 1; } printf("%d\n",length); int i; for(i = 0 ; i < length; i++){ numArr[i] = inputNum % 10; inputNum /= 10; } for(i=length-1;i>=0;i--){ printf("%d ",numArr[i]); } printf("\n"); for(i=0;i<length;i++){ printf("%d",numArr[i]); } printf("\n"); return 0; }
0.0分
0 人评分