+ 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 Antworten
+ 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!! 👍🏻🙏🏻