fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. //convertir un numero decimal a binario
  6. int n;
  7. cin >> n;
  8. string binario;
  9. while(n > 0) {
  10. binario = to_string(n % 2) + binario;
  11. n = n / 2;
  12. }
  13. cout << binario << endl;
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
1010011000111