+ 1
Code Coach - Fruit Bowl
Hello, Iām a beginner and Iām facing some issues. Iām only getting 2 out of 5 test cases right. Below is my code: #include <iostream> #include <math.h> using namespace std; int main() { double fruit, NoOfApples, NoOfPies; //take input cin>>fruit; //your code goes here if(fruit>=6){ NoOfApples = 0.5*fruit; NoOfPies = NoOfApples/3; cout<<ceil(NoOfPies); } else{ cout<<0; } }
3 Answers
+ 6
Use integer instead of double (input and output is an integer).
Remove ceil. Just print NoOfApples.
+ 2
Danyal Ahmed Your welcome.
+ 1
It worked perfectly!
Thank you so much Denise!! šš»šš»