fork 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.6093f;
  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 5328KB
stdin
45
stdout
35.404602 -> 11.000001 ... 22
38.623203 -> 12.000001 ... 24
41.841805 -> 13.000001 ... 26
45.060406 -> 14.000002 ... 28
48.279007 -> 15.000002 ... 30
51.497608 -> 16.000002 ... 32
54.716209 -> 17.000002 ... 34
57.934811 -> 18.000004 ... 36
61.153412 -> 19.000004 ... 38
64.372009 -> 20.000002 ... 40
67.590607 -> 21.000002 ... 42
70.809204 -> 22.000002 ... 44
74.027802 -> 23.000000 ... 46
77.246399 -> 24.000000 ... 48
80.464996 -> 24.999998 ... 48
83.683594 -> 25.999998 ... 50
86.902191 -> 26.999996 ... 52
90.120789 -> 27.999996 ... 54
93.339386 -> 28.999996 ... 56
96.557983 -> 29.999994 ... 58
99.776581 -> 30.999994 ... 60
102.995178 -> 31.999992 ... 62
106.213776 -> 32.999992 ... 64
109.432373 -> 33.999992 ... 66
112.650970 -> 34.999989 ... 68
115.869568 -> 35.999989 ... 70
119.088165 -> 36.999989 ... 72
122.306763 -> 37.999989 ... 74
125.525360 -> 38.999989 ... 76
128.743958 -> 39.999985 ... 78
125.525360 -> 38.999989 ... 76
122.306763 -> 37.999989 ... 74
119.088165 -> 36.999989 ... 72
115.869568 -> 35.999989 ... 70
112.650970 -> 34.999989 ... 68
109.432373 -> 33.999992 ... 66
106.213776 -> 32.999992 ... 64
102.995178 -> 31.999992 ... 62
99.776581 -> 30.999994 ... 60
96.557983 -> 29.999994 ... 58
93.339386 -> 28.999996 ... 56
90.120789 -> 27.999996 ... 54
86.902191 -> 26.999996 ... 52
83.683594 -> 25.999998 ... 50
80.464996 -> 24.999998 ... 48
77.246399 -> 24.000000 ... 48
74.027802 -> 23.000000 ... 46
70.809204 -> 22.000002 ... 44
67.590607 -> 21.000002 ... 42
64.372009 -> 20.000002 ... 40
61.153408 -> 19.000002 ... 38
57.934807 -> 18.000002 ... 36
54.716206 -> 17.000002 ... 34
51.497604 -> 16.000002 ... 32
48.279003 -> 15.000001 ... 30
45.060402 -> 14.000000 ... 28
41.841801 -> 13.000000 ... 26
38.623199 -> 12.000000 ... 24
35.404598 -> 10.999999 ... 20
32.185997 -> 9.999999 ... 18