#include <stdio.h>

int main()

{

    int i,count=0,x[5];             //count统计位数,x[5]储存数字

    for (i=0;i<5;i++)

    {

        int temp=0;

        temp=getchar();             //temp临时储存数字字符的ASCII码

        if (temp==10) break;      //输入换行\n后跳出for循环

        count++;

        x[i]=temp-48;               //字符0的ASCII码是48

    }

    printf("%d\n",count);

    for (i=0;i<=count-2;i++) printf("%d ",x[i]);

    printf("%d\n",x[i]);

    for (i=count-1;i>=0;i--) printf("%d",x[i]);

    return 0;

}


    temp==10就相当于\n

    temp-48就相当于0



 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区