Answers for "rounding down in c++"

C++
1

c++ round number down

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	double num1 = 4.8;
  	double num2 = 4.3;
  	cout << floor(num1) << endl; // --> 4
  	cout << floor(num2) << endl; // --> 4
}
Posted by: Guest on August-28-2021
0

rounding off to nearest integer in c++

double round(double x);
float round(float x);
long double round(long double x);
double round(T x); // For integral type
Posted by: Guest on July-07-2020

Browse Popular Code Answers by Language