#include <stdio.h>
int arredonda (double x)
{
    int arredondado;
    if (x - (int)x >= 0.5)
        arredondado = (int)x + 1;
    else
        arredondado = (int)x;
    return arredondado;
}
int main()
{
    double num;
    scanf("%f", &num);
    printf("%d", arredonda(num));
    return 0;
}
This is a function that rounds a number to upper or to lower depending of the decimal part. The problem is that it keeps returning 0 with all values.
 
     
    