fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. string na2(int liczba) {
  6. if (liczba==0)
  7. return "0";
  8. string pom=" ";
  9. while (liczba>0){
  10. pom=char( liczba%2+48)+pom;
  11. liczba=liczba/2;
  12. }
  13. return pom;
  14. }
  15. int main() {
  16. cout<<na2(42) <<" , "<<na2(53)<<endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
101010  , 110101