fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5. int input;
  6.  
  7. for (input = 0; input < 50; ++input) {
  8. int rounded = (int)(round((float)input / 5) * 5);
  9. printf("%d -> %d\n", input, rounded);
  10. }
  11.  
  12. return 0;
  13. }
Success #stdin #stdout 0.02s 1720KB
stdin
Standard input is empty
stdout
0 -> 0
1 -> 0
2 -> 0
3 -> 5
4 -> 5
5 -> 5
6 -> 5
7 -> 5
8 -> 10
9 -> 10
10 -> 10
11 -> 10
12 -> 10
13 -> 15
14 -> 15
15 -> 15
16 -> 15
17 -> 15
18 -> 20
19 -> 20
20 -> 20
21 -> 20
22 -> 20
23 -> 25
24 -> 25
25 -> 25
26 -> 25
27 -> 25
28 -> 30
29 -> 30
30 -> 30
31 -> 30
32 -> 30
33 -> 35
34 -> 35
35 -> 35
36 -> 35
37 -> 35
38 -> 40
39 -> 40
40 -> 40
41 -> 40
42 -> 40
43 -> 45
44 -> 45
45 -> 45
46 -> 45
47 -> 45
48 -> 50
49 -> 50