#include
main()
{
int n,w,sum = 0;
printf("please input a number(Ê®½øÖÆ):");
scanf("%d",&n);
w = n;
for(;n;n = n/2)
{
sum += n%2;
}
printf("%d\n",sum);
for(; w ; w = w / 2)
printf("%d",w%2); // 输出输入的十进制的二进制的倒序数,以便观察运行结果的正确性
printf("\n");
}
阅读(1289) | 评论(0) | 转发(0) |