0

Halloween candy

#include <iostream> #include <cmath> using namespace std; int main(){ double houses; double x; cin >> houses; if(houses>=3) x = 2/houses*100; cout<<round(x); } Basically, with the above code I got 2 out of 5 ticks when tested. What changes would be suggested?

25th Dec 2022, 6:45 AM
Ozcan
3 odpowiedzi
+ 6
Ozcan , Instead cout<<round(x) Use , cout<<ceil(x) try it...
25th Dec 2022, 8:44 AM
Riya
Riya - avatar
+ 4
Ozcan , You're welcome
25th Dec 2022, 12:39 PM
Riya
Riya - avatar
+ 1
thanks Riya
25th Dec 2022, 10:29 AM
Ozcan