反序数

来源:互联网 发布:淘宝购买iphone7p美版 编辑:程序博客网 时间:2024/04/19 14:30
#include <stdio.h>
int main()
{
    int i;
    for(i=1002; i<1111; i++)//穷举四位数可能值
        if(i%10*1000+i/10%10*100+i/100%10*10+i/1000==i*9)//判断反序数是否为原整数的9倍
        printf("The number satisfied states condition is:%d\n",i);
    return 0;

}

[root@localhost 20]# ls
contrary  contrary.c
[root@localhost 20]# ./contrary
The number satisfied states condition is:1089

0 0
原创粉丝点击