Question: Write a menu driven program to do each of the following. Continue to prompt the user with the menu until option 11 Quit is selected.

Write a menu driven program to do each of the following. Continue to prompt the user with the menu until option 11 Quit is selected. Display an error message if the user makes an invalid selection.

PART I. SINGLE LOOPS Use the appropriate loop to do the following:

1. Write a WHILE LOOP that will print one row of 15 asterisks to the screen.

2. Write a FOR LOOP that will print one row of 15 asterisks to the screen.

3. Display the odd numbers between 1 and 50.

4. Write a code segment that will prompt the user to enter a positive number, max. Verify the number is positive before continuing. Display all integers from 1 to max.

5. Write a code segment that will prompt the user to enter a negative number, min. Verify the number is negative before continuing. Display all integers from 1 down to min.

6. Write a code segment that will prompt the user to enter a positive number, max. Sum all the even numbers from 2 to max and display the total.

7. Write a code segment that will prompt the user for a positive number, max, and display a table of integers from 1 to max. Display only 5 integers in each row. For example, the user enters a max of 12.

1 2 3 4 5

6 7 8 9 10

11 12

Hint: Find the pattern as to when a newline needs to occur. (Use the modulus (%) operator)

Hint2: Use printf( ) to format the numbers into columns

PART II. NESTED for LOOPS LAB

For problems 8-10, only one character (* or ) may be output at a time

8. Print a sequence of asterisk characters in the following configuration, continuing for LINES number of asterisks. LINES is a named constant with the value of 7.

*

*

*

*

*

*

*

9-10 Write nested for-loops that will display each of the following patterns:

9. ********** 10. **********

********* *********

******** ********

******* *******

****** ******

***** *****

**** ****

*** ***

** **

* *

11. Quit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!