代码语言:javascript复制
void fun25(void)
{
int i, j, num;
unsigned ask = 0x8000;
scanf("%d", &num);
//方法一
for (i = 0; i < 16; i )
{
printf("%d", (num & ask) ? 1 : 0);
ask = ask >> 1;
}
//方法二
while (num != 0)
{
printf("%d", num % 2);
num /= 2;
}
}