#include <iostream>
#include <cstdio>
#include <math.h>
#include <stack>
using namespace std;
int main(){
unsigned int n;
while (scanf("%d", &n) != EOF){
if (n<0 ||n > pow(10,8) ){
break;
}
stack<int> sta;
while(n != 0){//进制转化
sta.push(n%2);
n = n/2;
}
int m = sta.size();
// int flag = 0;
for(int i = 0;i < m;i ++){
printf("%d",sta.top());
sta.pop();
}
printf("\n");
}
}
二进制数
最新推荐文章于 2024-03-22 11:07:19 发布