+ 1

Question is given fruit number should be even. Half of it is apples and half banana. Takes 3 apples to make one pie. I

This is my code below which asks input as number of fruits and number of pies as output. My code fails 3 out of 5 test conditions. Please help!!! #include <stdio.h> int b(int c); int main() { int fruit; int a; scanf("%d", &fruit); if(fruit>=6 && fruit%2==0) {a=b(fruit); printf("%d",a);} else{ printf("0");} return 0; } int b(int c) {int apples; int pies; apples=c/2; pies=apples/3; return(pies); }

16th Nov 2020, 7:17 AM
Sohel Kumar Samantaray
Sohel Kumar Samantaray - avatar
0 Resposta