鱼C论坛

 找回密码
 立即注册
查看: 6260|回复: 2

不对

[复制链接]
发表于 2023-11-19 10:22:24 | 显示全部楼层
  1. #include <stdio.h>
  2. int main() {
  3.     int n, i, count = 0, j;
  4.     int a[5];
  5.     scanf("%d", &n);
  6.     int k = n;
  7.     while (n != 0) {
  8.         n = n / 10;
  9.         count++;
  10.     }
  11.     n = k;
  12.     for (i = count - 1; i >= 0; i--) {
  13.         j = n % 10;
  14.         a[i] = j;
  15.         n = n / 10;
  16.     }
  17.     printf("%d\n", count);
  18.     for (i = 0; i < count; i++) {
  19.         printf("%d ", a[i]);
  20.     }
  21.     printf("\n");
  22.     for (i = count - 1; i >= 0; i--) {
  23.         printf("%d ", a[i]);
  24.     }
  25.     printf("\n");
  26.     return 0;
  27. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2026-4-2 01:14

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表