Answers for "how to round decimals in c"

C++
1

rounding decimal number in C

#include <stdio.h>
#include <math.h>
 int main()
{
       float i=5.4, j=5.6;
       printf("round of  %f is  %fn", i, round(i));
       printf("round of  %f is  %fn", j, round(j));
       return 0;
}
Posted by: Guest on July-30-2021
1

how print fload wiht 2 decimal in c++

#include <iostream>
#include <cstdio>
using namespace std;

int main() 
{
    // This code helps you to print a number with desired decimal
    double Number=10.3454;
    printf("%.3lf",Number);

    return 0;
}
Posted by: Guest on June-07-2020

Browse Popular Code Answers by Language