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.609344f;
  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.405571 -> 11.000001 ... 22
38.624260 -> 12.000001 ... 24
41.842949 -> 13.000002 ... 26
45.061638 -> 14.000002 ... 28
48.280327 -> 15.000002 ... 30
51.499016 -> 16.000002 ... 32
54.717705 -> 17.000002 ... 34
57.936394 -> 18.000004 ... 36
61.155083 -> 19.000004 ... 38
64.373772 -> 20.000004 ... 40
67.592461 -> 21.000004 ... 42
70.811150 -> 22.000004 ... 44
74.029839 -> 23.000004 ... 46
77.248528 -> 24.000004 ... 48
80.467216 -> 25.000006 ... 50
83.685905 -> 26.000006 ... 52
86.904594 -> 27.000006 ... 54
90.123283 -> 28.000006 ... 56
93.341972 -> 29.000006 ... 58
96.560661 -> 30.000006 ... 60
99.779350 -> 31.000008 ... 62
102.998039 -> 32.000008 ... 64
106.216728 -> 33.000008 ... 66
109.435417 -> 34.000008 ... 68
112.654106 -> 35.000008 ... 70
115.872795 -> 36.000008 ... 72
119.091484 -> 37.000008 ... 74
122.310173 -> 38.000008 ... 76
125.528862 -> 39.000008 ... 78
128.747543 -> 40.000008 ... 80
125.528854 -> 39.000008 ... 78
122.310165 -> 38.000008 ... 76
119.091476 -> 37.000008 ... 74
115.872787 -> 36.000008 ... 72
112.654099 -> 35.000004 ... 70
109.435410 -> 34.000004 ... 68
106.216721 -> 33.000004 ... 66
102.998032 -> 32.000004 ... 64
99.779343 -> 31.000004 ... 62
96.560654 -> 30.000004 ... 60
93.341965 -> 29.000004 ... 58
90.123276 -> 28.000004 ... 56
86.904587 -> 27.000004 ... 54
83.685898 -> 26.000004 ... 52
80.467209 -> 25.000002 ... 50
77.248520 -> 24.000002 ... 48
74.029831 -> 23.000002 ... 46
70.811142 -> 22.000002 ... 44
67.592453 -> 21.000002 ... 42
64.373764 -> 20.000002 ... 40
61.155075 -> 19.000000 ... 38
57.936386 -> 18.000000 ... 36
54.717697 -> 17.000000 ... 34
51.499008 -> 16.000000 ... 32
48.280319 -> 15.000000 ... 30
45.061630 -> 13.999999 ... 26
41.842941 -> 12.999999 ... 24
38.624252 -> 11.999999 ... 22
35.405563 -> 10.999998 ... 20
32.186874 -> 9.999998 ... 18