+ 1
Is this code accurate ? Or is it wrong ?
5 odpowiedzi
+ 2
You take input as fruit✅
You divide fruit by 2 and assign that to apples✅
You divide apples by 3 and assign that to b✅
You then do some stuff with modulo 3 and subtracting that from apples ❓
You then do an if check on modulo 2 for some reason❓
You then print the result of your side quest of modulo divided by 3❓✅❓
You can just print b✅
{edit: your code without modification passed all test cases. That means it is not wrong. well done✅}
+ 2
You can also do it like this
cout<<fruit/6;
+ 1
😅Thank you very much for answering I think with more practice I will be able to avoid unnecessary stuff like that . But somehow it works and that is all I needed to know Thanks.
+ 1
Yeah that's true too🤔
0
Fruit bowl:
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