0
How can i round off 200/3 in c++?
I need this to solve Halloween candy challenge in code coach in sololearn.
8 Respuestas
+ 2
Use <cmath> header.
Use round, ceil , floor whichever fits your need , challenge gives you enough details to determine.
https://www.programiz.com/cpp-programming/library-function/cmath
+ 2
Use floor to round down
Use ceil to round up
Use search as this question has been answered before.
+ 1
RIJU JOSDAS Did you bother to read and understand the answers you received?
+ 1
If you want to solve this problem there is no need to use any rounding off operator as it can be done without it too.
#include <iostream>
using namespace std;
int main()
{
int houses;
int a;
cin>> houses;
a=200/houses;
if (200%houses==0)
cout<< a;
else
cout<< a+1;
return 0;
}
Like this.
0
Bro round isn't working
0
It always rounds down and never rounds up
0
Bro i tried them already