Answer :

Answer:

In order to make the following code in C it is necessary to take in consideration the possible tree of choices, or decision make trees.

Code:

#include <stdio.h>

int main(){

       printf("Please answer with (y/n) \n");

       printf("How about comedy movies?  ");

       char optional[2];

       scanf("%s",&optional);

       if(optional[0] == 'y'){

               printf("Recommended: CENTRAL INTELLIGENCE\n");

       } else if(optional[0] == 'n'){

               printf("Then, how about a current movie ?  ");

               scanf("%s",&optional);

               if(optional[0] == 'y' ){

                       printf("Recommended: HOBBS & SHAW\n");

               }else if(optional[0] == 'n') {

                       printf("how about electronic games ?  ");

                       scanf("%s",&optional);

                       if(optional[0] == 'y' ){

                               printf("Certified Fresh ?  ");

                               scanf("%s",&optional);

                               if(optional[0] == 'y'){

                                       printf("recommended JUMANJI : WELCOME TO THE JUNGLE\n");

                               }else if(optional[0] == 'n') {

                                       printf("RAMPAGE");

                               }

                       }else if(optional[0] == 'n') {

                               

                               printf("about franchises ?  ");

                               scanf("%s",&optional);

                               if(optional[0] == 'y'){

                                       printf("Recommended: FAST FIVE\n");

                               }else if(optional[0] == 'n') {

                                       printf("How about animation ?  ");

                                       scanf("%s",&optional);

                                       if(optional[0] == 'y'){

                                               printf("recommended: MOANA\n");

                                       }else if(optional[0] == 'n') {

                                               printf("recommended: SKYSCRAPPER\n");

                                       }

                               }

                               

                       }

               }

       }        

       return 1;

}

Other Questions