1console.log(Math.floor(5.95));
2// expected output: 5
3
4console.log(Math.floor(5.05));
5// expected output: 5
6
7console.log(Math.floor(5));
8// expected output: 5
9
10console.log(Math.floor(-5.05));
11// expected output: -6
1#include <iostream>
2#include <cmath>
3
4using namespace std;
5
6int main()
7{
8 int x = 15;
9 double result;
10 result = floor(x);
11 cout << "Floor of " << x << " = " << result << endl;
12
13 return 0;
14}
15