+ 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