正整数的打印.c 435 B

1234567891011121314151617181920212223242526272829
  1. #include <stdio.h>
  2. int main() {
  3. int num, digit, count = 0;
  4. scanf("%d", &num);
  5. int temp = num;
  6. while (temp != 0) {
  7. digit = temp % 10;
  8. temp = temp / 10;
  9. count++;
  10. }
  11. printf("%d\n", count);
  12. printf("%d\n",num);
  13. while (num != 0) {
  14. digit = num % 10;
  15. printf("%d", digit);
  16. num = num / 10;
  17. }
  18. printf("\n");
  19. return 0;
  20. }