fork(1) download
  1. #include<stdlib.h>
  2. #include<math.h>
  3.  
  4. double round_down(double value, int decimals) {
  5. double multipliers = pow(10, decimals);
  6. return (int)(value*multipliers)/multipliers;
  7. }
  8.  
  9. int main() {
  10. printf("%.1f", round_down(2.2727, 1));
  11. return 0;
  12. }
Success #stdin #stdout 0s 1788KB
stdin
Standard input is empty
stdout
2.2