Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ round number to whole

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	double num1 = 4.8;
  	double num2 = 4.3;
  	cout << round(num1) << endl; // --> 5
  	cout << round(num2) << endl; // --> 4
}
 
PREVIOUS NEXT
Tagged: #number
ADD COMMENT
Topic
Name
7+5 =