fork(10) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. float n1 = 4;
  5. float n2 = 9;
  6.  
  7. float total = n2 / n1 ;
  8. float truncado = floor( total * 10.0f ) / 10.0f;
  9.  
  10. printf("Media: %.1f\n", truncado );
  11. printf("Media: %.2f\n", truncado );
  12. printf("Media: %.5f\n", truncado );
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
Media: 2.2
Media: 2.20
Media: 2.20000