- #include<stdio.h>
- void dectobin(int n);
- int main()
- {
- int x=0;
- scanf("%d",&x);//只能正数
- dectobin(x);
- printf("\n");
- return 0;
- }
- void dectobin(int n)
- {
- if(n/2>0)
- {
- dectobin(n/2);
- printf("%d",n%2);
- }
- else
- {
- printf("%d",n);
- }
- }
十进制保存成2进
猜你喜欢
转载自blog.csdn.net/qq_40525008/article/details/78987894
今日推荐
周排行