Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions

Question

How could assessment be used in an employee development program?

Answered: 1 week ago