Answer to Question #299815 in C for Justin

Question #299815

1. Create a program based on the attached output using the do-while loop.

2. Your program will keep asking the user to choose from the Options.And the program exits until the user selects Exit.



1
Expert's answer
2022-02-19T03:22:50-0500
#include <stdio.h>

int main()
{
   int option;
   do {
       printf("Please choose options:\n");
       printf("(1) Option number 1\n");
       printf("(2) Option number 2\n");
       printf("(3) Option number 3\n");
       printf("(4) Exit\n");
       printf("Enter: ");
       scanf("%d", &option);
    if (option < 0 | option > 4)
      printf( "Invalid options\n\n" );
    else if (option != 4)
      printf( "Option %d selected\n\n", option);
      } while ( option != 4 );
    printf( "Exit\n" );
    
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS