+ 2
This code is valid only for tesr case 1 z help me in this Fruit bowl code coach solution
#include <iostream> using namespace std; int main() { int fruit; //take input cin>>fruit; //your code goes here if(fruit%2==0){ int a=fruit/2; int b=fruit/2; int c=0; while(b%3==0){ ++c; b--; } cout<<c; } else{ cout<<"Enter even number"; } return 0; }
6 Respostas
+ 2
The question is saying that the bowl has only even no. of fruits so no need of the first condition.
Secondly, pies are made by using 3 apples only and not the other fruits, so division operation will be applied to fruits and corresponding result i.e., amount of apples will use a division again by 3 resulting in the total amount of pies.
+ 2
Kindly share the problem link!
Also try to avoid sharing code as paragraph, put your code in code bits and share the link here
0
Tanu Jain
This challenge starts like this.
int main() {
int fruit, apples, pies;
//take input
cin>>fruit;
//your code goes here
Your code has corrupted the section prior to where you were supposed to put your code, so that makes it difficult to achieve a result.
You don't need all the % bits, the int division will automatically get rid of any extras.
Number of fruit / by 2 = apples
Number of apples / by 3 = pies
Just to repeat myself:
int / int = int
0
Surbhi Yadav Plz send me the codeđđđđđđđđđđđđ
0
Tanu Jain Yeah sure!