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.609f;
  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 0s 5320KB
stdin
45
stdout
35.397999 -> 11.000000 ... 22
38.615997 -> 11.999999 ... 22
41.833996 -> 12.999999 ... 24
45.051994 -> 13.999998 ... 26
48.269993 -> 14.999998 ... 28
51.487991 -> 15.999998 ... 30
54.705990 -> 16.999998 ... 32
57.923988 -> 17.999996 ... 34
61.141987 -> 18.999996 ... 36
64.359985 -> 19.999996 ... 38
67.577988 -> 20.999996 ... 40
70.795990 -> 21.999998 ... 42
74.013992 -> 22.999998 ... 44
77.231995 -> 23.999998 ... 46
80.449997 -> 25.000000 ... 50
83.667999 -> 26.000000 ... 52
86.886002 -> 27.000002 ... 54
90.104004 -> 28.000002 ... 56
93.322006 -> 29.000002 ... 58
96.540009 -> 30.000004 ... 60
99.758011 -> 31.000004 ... 62
102.976013 -> 32.000004 ... 64
106.194016 -> 33.000004 ... 66
109.412018 -> 34.000008 ... 68
112.630020 -> 35.000008 ... 70
115.848022 -> 36.000008 ... 72
119.066025 -> 37.000008 ... 74
122.284027 -> 38.000008 ... 76
125.502029 -> 39.000011 ... 78
128.720032 -> 40.000011 ... 80
125.502029 -> 39.000011 ... 78
122.284027 -> 38.000008 ... 76
119.066025 -> 37.000008 ... 74
115.848022 -> 36.000008 ... 72
112.630020 -> 35.000008 ... 70
109.412018 -> 34.000008 ... 68
106.194016 -> 33.000004 ... 66
102.976013 -> 32.000004 ... 64
99.758011 -> 31.000004 ... 62
96.540009 -> 30.000004 ... 60
93.322006 -> 29.000002 ... 58
90.104004 -> 28.000002 ... 56
86.886002 -> 27.000002 ... 54
83.667999 -> 26.000000 ... 52
80.449997 -> 25.000000 ... 50
77.231995 -> 23.999998 ... 46
74.013992 -> 22.999998 ... 44
70.795990 -> 21.999998 ... 42
67.577988 -> 20.999996 ... 40
64.359985 -> 19.999996 ... 38
61.141987 -> 18.999996 ... 36
57.923988 -> 17.999996 ... 34
54.705990 -> 16.999998 ... 32
51.487991 -> 15.999998 ... 30
48.269993 -> 14.999998 ... 28
45.051994 -> 13.999998 ... 26
41.833996 -> 12.999999 ... 24
38.615997 -> 11.999999 ... 22
35.397999 -> 11.000000 ... 22
32.180000 -> 10.000000 ... 20