点击(此处)折叠或打开
- #include <stdio.h>
-
- int main(){
- int num;
- printf("Enter the number: ");
- scanf("%d", &num);
- //判断万位和个位是否相等,并且千位和十位是否相等
- if (num / 10000 == ((((num % 10000) % 1000) % 100) % 10) && num % 10000 / 1000 == num % 10000 % 1000 % 100 / 10)
- printf("这是一个回数!\n");
- else
- printf("这不是一个回数!\n");
- return 0;
- }
-
- /*
- 万位数字 num/10000
- 千位数字 (num%10000)/1000
- 百位数字 ((num%10000)%1000)/100
- 十位数字 (((num%10000)%1000)%100)/10
- 个位数字 ((((num % 10000) % 1000) % 100) % 10)
- */
相关热门文章
给主人留下些什么吧!~~
评论热议