fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a = 1, b = 16;
  6.  
  7. cout << "Rozwiniecie binarne 1/16: 0.";
  8.  
  9. while (a > 0) {
  10. a *= 2;
  11. if (a >= b) {
  12. cout << '1';
  13. a -= b;
  14. } else {
  15. cout << '0';
  16. }
  17. }
  18.  
  19. cout << endl;
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
Rozwiniecie binarne 1/16: 0.0001