+ 1
Is this code accurate ? Or is it wrong ?
5 Answers
+ 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