fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main(void) {
  5. printf("%.0f\n", round(0.2));
  6. printf("%.0f\n", round(0.5));
  7. printf("%.0f\n", round(0.8));
  8. printf("%.0f\n", round(1.2));
  9. printf("%.0f\n", round(1.5));
  10. printf("%.0f\n", round(1.8));
  11. printf("%.0f\n", round(-0.2));
  12. printf("%.0f\n", round(-0.5));
  13. printf("%.0f\n", round(-0.8));
  14. printf("%.0f\n", round(-1.2));
  15. printf("%.0f\n", round(-1.5));
  16. printf("%.0f\n", round(-1.8));
  17. }
  18.  
  19. //https://pt.stackoverflow.com/q/579752/101
Success #stdin #stdout 0.01s 5444KB
stdin
Standard input is empty
stdout
0
1
1
1
2
2
-0
-1
-1
-1
-2
-2