Miquel_Fuster

Redondeo a la décima más cercana.

Oct 16th, 2021 (edited)
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.15 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5.    float f = 4.45;
  6.  
  7.    printf("%f\n", f);
  8.    
  9.    f = round(f*10) / 10;
  10.  
  11.    printf("%f\n", f);
  12. }
Add Comment
Please, Sign In to add comment