题解 | #变种水仙花#

判断整数奇偶性

http://www.nowcoder.com/practice/a8b018667e274af29b5f76a6673450fc

#include <stdio.h>
int main()
{
    int i, sum;
    for(i = 10000; i <= 99999; i++)
    {
        int temp = i;
        sum = (temp % 10)*(temp / 10) + (temp % 100)*(temp / 100) + (temp % 1000)*(temp / 1000) + (temp % 10000)*(temp / 10000);
        if(sum == i)
            printf("%d ",temp);
    }
    return 0;
}
全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务