标签:des style blog io color sp div on log
1 #include <stdio.h> 2 3 int judge_sky(int number); 4 5 int main(){ 6 int number; 7 8 while(1){ 9 scanf("%d",&number); 10 11 if(number==0) 12 break; 13 14 if(judge_sky(number)==1) 15 printf("%d is a Sky Number.\n",number); 16 17 else 18 printf("%d is not a Sky Number.\n",number); 19 20 21 } 22 23 24 return 0; 25 } 26 27 int judge_sky(int number){ 28 int _10_result=0; 29 int _16_result=0; 30 int _12_result=0; 31 int temp=number; 32 33 while(number){ 34 _10_result+=(number%10); 35 number/=10; 36 } 37 38 number=temp; 39 while(number){ 40 _16_result+=(number%16); 41 number/=16; 42 } 43 44 number=temp; 45 while(number){ 46 _12_result+=(number%12); 47 number/=12; 48 } 49 50 if(_10_result==_16_result && _10_result==_12_result) 51 return 1; 52 53 else 54 return 0; 55 56 }
标签:des style blog io color sp div on log
原文地址:http://www.cnblogs.com/zqxLonely/p/4054280.html