Write a c language | Sololearn: Learn to code for FREE!

0

Write a c language

8. There are four types of fruits Apples, Oranges, Bananas and Grapes. Each student can pick up two fruits. There are some conditions which have to be used to pick up the fruits. Draw a flow chart which can take the name of first fruit as an input and print the names of second fruit or fruits that can be picked up. The conditions are: • If you pick an apple you can pick banana. • If you pick orange you can pick grapes. • If you pick grapes you can pick banana. Hint: There will be one input box to read the first fruit, three decision boxes and four output boxes in the flowchart. Use “ “ for string and == operator.

4/25/2021 5:25:58 PM

vivek_sai 0449

7 Answers

New Answer

+3

Vivek Post your attempt first to get help from the community .And Try to solve these challenges yourself as far as possible for your own progress ...

+2

#include<stdio.h> #include<string.h> void main() { printf("Picking of fruit\n"); printf("PICK ANY TWO FRUITS FROM \nAPPLE\nBANANA\nGRAPE\nORANGE\n"); char "apple","orange","banana","grape"; char i[10]; int n; gets(i); n = 0; while(n<2) { if (i=="apple"||i=="Apple") { printf("U CAN PICK BANANA also\n"); } else if(i=="orange"||i=="Orange") { printf("U CAN PICK GRAPES also\n"); } else if(i=="grapes"||i=="Grapes") { printf("U CAN PICK BANANA also\n"); } else if(i=="banana"||i=="Banana") { printf("U CAN PICK APPLE also\n"); } n+=1; if(n<2) { gets(i); } } } '

+1

Is their any worng let me note it

0

Go and see this answer and go and learn it

-1

// Created by Vivek #include<stdio.h> #include<string.h> int main() { printf("Picking of fruit\n"); printf("PICK ANY TWO FRUITS FROM \nAPPLE\nBANANA\nGRAPE\nORANGE\n"); char i[10]; int n; gets(i); n = 0; while(n<2) { if (!strcmp(i,"apple")||!strcmp(i,"Apple")) { printf("U CAN PICK BANANA also\n"); } else if(!strcmp(i,"orange")||!strcmp(i,"Orange")) { printf("U CAN PICK GRAPES also\n"); } else if(!strcmp(i,"grapes")||!strcmp(i,"Grapes")) { printf("U CAN PICK BANANA also\n"); } else if(!strcmp(i,"banana")||!strcmp(i,"Banana")) { printf("U CAN PICK APPLE also\n"); } n+=1; if(n<2) { gets(i); } } return 0; }