c how to program 习题3.34

发布于2020-05-12 775 热度

运行结果:

C语言代码:

/* c how to program 习题3.34 */
#include <stdio.h>

// function main begins program execution
int main( void )
{
    //定义变量
    int number;
    printf("请输入一个5位的整数:");
    scanf("%d", &number);
    while(number < 10000 || number > 99999){
        printf("你的输入有误,新重新输入:");
        scanf("%d", &number);
    }
    (number/10000 == number%10 && number%10000/1000 == number/10%10) ? printf("%d是回文数\n", number) : printf("%d不是回文数\n", number);
}

记录工作,记录学习,分享知识,分享经验……