What is wrong with the code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is wrong with the code?

Was solving the "Easy" problem "Halloween Candy". The code passes only through the first two cases. But the rest of the cases are hidden. So I'm unable to know what is wrong with the code. #include <stdio.h> int main() { int houses; scanf("%d", &houses); //your code goes here if (houses < 3) { return 1; } float answer = (2.00/houses)*100.00; answer = round(answer); printf("%d", (int)(answer)); return 0; }

12th Mar 2022, 9:33 AM
Ashok Ighe
Ashok Ighe - avatar
1 Answer
+ 2
#include <math.h> ... answer = ceil(answer) https://www.sololearn.com/Discuss/2718934/?ref=app
12th Mar 2022, 9:51 AM
Simba
Simba - avatar