阅读量:126
在C语言中,可以使用printf函数的格式控制符“%b”来以二进制形式输出数字。以下是一个示例代码:
#include
int main() {
int num = 10;
printf("The binary representation of %d is %b\n", num, num);
return 0;
}
运行该代码,将会输出:
The binary representation of 10 is 1010