cheng_you_know

学而时习之!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
#include <iostream>
using namespace std;
int convert(int number,int radix)
{
    int sum=0;
    sum += number%radix;
    number = number/radix;
    while(number!=0)
    {
        sum += number%radix;
        number/=radix;
    }
    return sum;
}
int main()
{
    int n;
    while((scanf("%d",&n))!=EOF && n)
    {
        if((convert(n,10)==convert(n,16))&&(convert(n,16)==convert(n,12)))
            printf("%d is a Sky Number.\n",n);
        else
            printf("%d is not a Sky Number.\n",n);
    }
    return 0;
}
posted on 2013-07-10 20:30  cheng_you_know  阅读(172)  评论(0编辑  收藏  举报