C language rounding

www.lautt‮ru‬i.com
C language rounding

When using %f formatting in the printf function, you can add the specified number to get precision.

#include <stdio.h>

int main (){
    float a = 3.1415926;

    printf("\ndefault precision: %f", a);
    printf("\nZero decimal: %.0f", a);
    printf("\nOne decimal: %.1f", a);
    return 0;
}
Created Time:2017-08-22 16:23:56  Author:lautturi