fork(1) download
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C/C++.
  5. Code, Compile, Run and Debug online from anywhere in world.
  6.  
  7. *******************************************************************************/
  8. #include <iostream>
  9. #include <bits/stdc++.h>
  10. using namespace std;
  11.  
  12. int main()
  13. {
  14. float mile = 1.60934f;
  15. float val = 20.0f * mile;
  16. for (int i = 0; i < 30; i++) {
  17. val += 2.0f * mile;
  18. printf("%f -> %f ... %i\n", val, val / 2.0f / mile, (int)(val / 2.0f / mile) * 2);
  19. }
  20. for (int i = 0; i < 30; i++) {
  21. val -= 2.0f * mile;
  22. printf("%f -> %f ... %i\n", val, val / 2.0f / mile, (int)(val / 2.0f / mile) * 2);
  23. }
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5292KB
stdin
45
stdout
35.405479 -> 11.000000 ... 22
38.624161 -> 12.000001 ... 24
41.842842 -> 13.000001 ... 26
45.061523 -> 14.000002 ... 28
48.280205 -> 15.000002 ... 30
51.498886 -> 16.000002 ... 32
54.717567 -> 17.000002 ... 34
57.936249 -> 18.000004 ... 36
61.154930 -> 19.000004 ... 38
64.373611 -> 20.000004 ... 40
67.592293 -> 21.000004 ... 42
70.810974 -> 22.000006 ... 44
74.029655 -> 23.000006 ... 46
77.248337 -> 24.000006 ... 48
80.467018 -> 25.000006 ... 50
83.685699 -> 26.000008 ... 52
86.904381 -> 27.000008 ... 54
90.123062 -> 28.000008 ... 56
93.341743 -> 29.000008 ... 58
96.560425 -> 30.000010 ... 60
99.779106 -> 31.000010 ... 62
102.997787 -> 32.000008 ... 64
106.216469 -> 33.000011 ... 66
109.435150 -> 34.000011 ... 68
112.653831 -> 35.000011 ... 70
115.872513 -> 36.000011 ... 72
119.091194 -> 37.000011 ... 74
122.309875 -> 38.000011 ... 76
125.528557 -> 39.000011 ... 78
128.747238 -> 40.000011 ... 80
125.528557 -> 39.000011 ... 78
122.309875 -> 38.000011 ... 76
119.091194 -> 37.000011 ... 74
115.872513 -> 36.000011 ... 72
112.653831 -> 35.000011 ... 70
109.435150 -> 34.000011 ... 68
106.216469 -> 33.000011 ... 66
102.997787 -> 32.000008 ... 64
99.779106 -> 31.000010 ... 62
96.560425 -> 30.000010 ... 60
93.341743 -> 29.000008 ... 58
90.123062 -> 28.000008 ... 56
86.904381 -> 27.000008 ... 54
83.685699 -> 26.000008 ... 52
80.467018 -> 25.000006 ... 50
77.248337 -> 24.000006 ... 48
74.029655 -> 23.000006 ... 46
70.810974 -> 22.000006 ... 44
67.592293 -> 21.000004 ... 42
64.373611 -> 20.000004 ... 40
61.154930 -> 19.000004 ... 38
57.936249 -> 18.000004 ... 36
54.717567 -> 17.000002 ... 34
51.498886 -> 16.000002 ... 32
48.280205 -> 15.000002 ... 30
45.061523 -> 14.000002 ... 28
41.842842 -> 13.000001 ... 26
38.624161 -> 12.000001 ... 24
35.405479 -> 11.000000 ... 22
32.186798 -> 10.000000 ... 20