#include "stdafx.h"
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int taban[30],a=0;
void tab(int x) {
do{
if(x%2==0) { taban[a] = 0 ;} else { taban[a]= 1; };
x=x/2;
a++;
}while(x/2!=0);
taban[a] = 1;
}
int main()
{
int x;
cin >> x;
tab(x);
for(;a>=0;a--) {
cout << taban[a] ;
}
system("pause");
return 0;
}

Hiç yorum yok:
Yorum Gönder