Is this code accurate ? Or is it wrong ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is this code accurate ? Or is it wrong ?

https://code.sololearn.com/c0q3Fv520KmV/?ref=app

8th Mar 2022, 8:08 AM
Norhan El-zomor
Norhan El-zomor - avatar
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āœ…}
8th Mar 2022, 9:07 AM
HungryTradie
HungryTradie - avatar
+ 2
You can also do it like this cout<<fruit/6;
8th Mar 2022, 9:49 AM
Simba
Simba - avatar
+ 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.
8th Mar 2022, 9:25 AM
Norhan El-zomor
Norhan El-zomor - avatar
+ 1
Yeah that's true toošŸ¤”
8th Mar 2022, 10:09 AM
Norhan El-zomor
Norhan El-zomor - avatar
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
8th Mar 2022, 9:01 AM
HungryTradie
HungryTradie - avatar