0

What is the output for this question?

enum fruit_tag { BLUEBERRY, BANANA, PINEAPPLE, WATERMELON }; typedef enum fruit_tag fruit_t; void printFruit(fruit_t myFruit) { switch(myFruit) { case BLUEBERRY: printf("a blueberry"); break; case BANANA: printf("a banana"); break; case PINEAPPLE: printf("a pineapple"); break; case WATERMELON: printf("a watermelon"); break; } } void compareFruit(fruit_t fruit1, fruit_t fruit2) { if (fruit1 > fruit2) { printFruit(fruit1); printf(" is larger than "); printFruit(fruit2); } else { printFruit(fruit1); printf(" is smaller than "); printFruit(fruit2); } } int main(void) { fruit_t myFruit = PINEAPPLE; fruit_t otherFruit = BLUEBERRY; compareFruit(myFruit, otherFruit); return 0; }

3rd Apr 2020, 3:11 PM
Mohamad Alkaleeh
7 ответов
0
Thanks for your answer, But Why did the Sololearn program not show me the answer? Is there a mistake in the codes?
3rd Apr 2020, 7:54 PM
Mohamad Alkaleeh
0
You are right😅 I was setting int main at the beginning too, i forgot it at the end there is Another question that didn't shows an answer int g (int x, int n) { for (int i = 0; i < n; i++) { if (i % 2 == 0) { x *= i + 1; continue; } x--; if (x == 0) { break; } } return x; } g(1,3)
3rd Apr 2020, 8:07 PM
Mohamad Alkaleeh
0
What is the problem with this code?
3rd Apr 2020, 8:08 PM
Mohamad Alkaleeh
0
Can you run this code on this sololearn program and share it here, thank you very much
3rd Apr 2020, 9:07 PM
Mohamad Alkaleeh