Created
August 6, 2019 06:01
-
-
Save parzibyte/69e4adbe7b0efea31cad9599e3fa25af to your computer and use it in GitHub Desktop.
Redondear con floor, ceil y round en C - https://parzibyte.me/blog/2018/11/08/redondear-numeros-en-c/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Redondear números con los 3 métodos en C | |
@author parzibyte | |
parzibyte.me/blog | |
*/ | |
#include<stdio.h> | |
#include<math.h> | |
int main(){ | |
float numero = 28.11; | |
float redondeado = round(numero); | |
float redondeadoHaciaAbajo = floor(numero); | |
float redondeadoHaciaArriba = ceil(numero); | |
printf("%0.2f con round es %0.2f, con floor %0.2f y con ceil %0.2f", numero, redondeado, redondeadoHaciaAbajo, redondeadoHaciaArriba); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment