You are on page 1of 1

#include <iostream>

using namespace std;

int main() {

int n, p;

cout << "Introduceti numarul: ";


cin >> n;

while (n > 1) {
if (n % 2 == 0) {
cout << "0";
n = n / 2;
}
else
{
cout << "1";
n = (n - 1) / 2;
}

}
cout << "1";
}

You might also like