Why can't pass 3,4,5 tests? Halloween candy | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why can't pass 3,4,5 tests? Halloween candy

#include <iostream> #include <cmath> using namespace std; int main() { int houses; cin>>houses; cout << round(2.0/houses*100); return 0; }

9th Sep 2021, 1:55 PM
Тирон Максим
Тирон Максим - avatar
5 Answers
+ 3
DenseAcid python tests also fails for the code you have written . Questions asks to "round up" not just round . round will round a number say 5.2 to 5 while round up will make it 6 . For rounding up there must be a ceil function in c++ Edit: you can add a tag "code coach" so it makes it easier for others to figure out the source of question or just link the question if possible!
9th Sep 2021, 2:05 PM
Abhay
Abhay - avatar
+ 1
DenseAcid Use ceil instead of round.
9th Sep 2021, 2:22 PM
A͢J
A͢J - avatar
0
Please provid more information
9th Sep 2021, 1:58 PM
Abhishek Kumar
Abhishek Kumar - avatar
0
The same python code passed, but c++ have some problems i think?
9th Sep 2021, 2:00 PM
Тирон Максим
Тирон Максим - avatar
0
Which information do u need?
9th Sep 2021, 2:01 PM
Тирон Максим
Тирон Максим - avatar