Then, ask the user to select one of the items in the menu (The user should enter an integer between 1 and 6. Any other input should print an error message and return to the user input)

computer science

Description

Practice iteration (the loop). In a WHILE loop, print out this menu of Book Categories:

 

1. Science Fiction

2. Computers and Technology

3. Cooking

4. Business

5. Comics

6. Exit

 

Then, ask the user to select one of the items in the menu (The user should enter an integer between 1 and 6. Any other input should print an error message and return to the user input). Based on the user’s choice, the output should be the book category related to the numerical choice, and maybe a complimentary message (e.g., “You selected Cooking. Cooking is a yummy choice”). After the category and message are displayed, the program should return the user to another opportunity to select from the menu. The loop should end only when the user selects number 6.

Write an R program that uses two nested FOR loops. The values used in the outer loop will be a user input value. The inner loop will use the input value divided by 2. Print a simple statement showing the values using the range of 1 to the user input number in the outer loop. The inner loop will print 1 to the divided result.


Related Questions in computer science category