Answers for "round function c++ upto 2 decimal places"

C++
1

round double to n decimal places c++

value = round( value * 100.0 ) / 100.0; // 2 decimal places
value = round( value * 1000.0 ) / 1000.0; // 3 decimal places
Posted by: Guest on September-13-2020
-1

get number round off to two decimal places c++

float a,b,c,d,sum;

 cin>>a>>b>>c>>d; // reading decimal values

sum=(a*b*c*d);

sum=round(sum*100)/100; // here it is for 2 decimal points

if((float)sum < (float) 9.58)
  cout<<"YESn";
else
  cout<<"NOn";
Posted by: Guest on April-03-2021

Code answers related to "round function c++ upto 2 decimal places"

Browse Popular Code Answers by Language