fork download
  1. #include <iostream>
  2. #include <stdio.h>
  3. using namespace std;
  4. void ConvertToBinary(int n);
  5. int main() {
  6. ConvertToBinary(18);
  7. return 0;
  8. }
  9. void ConvertToBinary(int n)
  10. {
  11. if (n / 2 != 0) {
  12. ConvertToBinary(n / 2);
  13. }
  14. printf("%d", n % 2);
  15. }
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
10010