what is my mistake here | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is my mistake here

Fruit Bowl +10 XP You have a bowl on your counter with an even number of pieces of fruit in it. Half of them are bananas, and the other half are apples. You need 3 apples to make a pie. Task Your task is to evaluate the total number of pies that you can make with the apples that are in your bowl given to total amount of fruit in the bowl. Input Format An integer that represents the total amount of fruit in the bowl. Output Format An integer representing the total number of whole apple pies that you can make. Sample Input 26 Sample Output 4 can u explain this i used this code for the above code coach challange and i dont see what my mistake is can any one explain it #include <iostream> using namespace std; int main() { int fruit; //take input cin>>fruit; int a=fruit/3; cout<<a<<endl; return 0; }

22nd Mar 2020, 4:07 PM
Immortal Soul
Immortal Soul - avatar
3 Answers
+ 4
Immortal Soul No because you are deviding total fruits by 3 but you need to devide only total Apple.
22nd Mar 2020, 4:28 PM
A͢J
A͢J - avatar
+ 3
Immortal Soul Check Problem again. There are two fruits Banana and Apple and you need to make pies on Apple. Check for the Example there are 26 amount of fruits in which half are banana so apple will be 13 and you need 3 Apple to make pie so a = 13/3 = 4
22nd Mar 2020, 4:17 PM
A͢J
A͢J - avatar
0
so i am correct
22nd Mar 2020, 4:25 PM
Immortal Soul
Immortal Soul - avatar