Answers for "c round to 3 decimal places"

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
0

round double to 2 decimal places c++

double d = 0.12345;
std::cout.precision(2); // for accuracy to 2 decimal places 
std::cout << d << std::endl; // 0.12
Posted by: Guest on September-13-2020

Code answers related to "c round to 3 decimal places"

Browse Popular Code Answers by Language