Question: Program Description Write a program to print a limited Pascal's Triangle, First, the user is instructed to enter the number of rows to be displayed,
Program Description
Write a program to print a limited Pascal's Triangle, First, the user is instructed to enter the number of rows to be displayed, and is prompted to enter an integer in the range The user enters a number, x and the program verifies that leq x leq If x is out of range, the user is reprompted until they enter a value in the specified range. The program then calculates and displays the first x rows of Pascal's Triangle.
Program Requirements
The programmer's name and program title must appear in the output.
The inain procedure must consist of only procedure calls with any necessary framing it should be a readable "list" of what the program will do
Each procedure will implement a section of the program logic, Le each procedure will specify frow the logic of its section is implemented.
The program must be modularized into at least the following procedures and subprocedures:
introduction Introduce Program and Programmer
getUserInput Prompt for and receive usermput number of triangle lines to print. Validate user input is in specified bounds and re
prompts as necessary.
printPascaltriangle Receives number of rows of Pascal's Triangle to print. Prints this number of rows of Pascal's Triangle. Uses:
printPoscaiRou to print each line.
Receives two values, n and k Outputs the result of n Choose k computation. See Binomial Coefficient Wikipedia Article
for more details.
printPascalRow Receives index of row to be printed. Prints allelements of Pascal's Triangle for this row. Uses nchoosek procedure to obtain each element to be printed.
a Thanks user for using the program.
The upper and lower bounds of user input must be defined as constants.
The directive is not allowed on this project.
If the user enters a number outside the range an error message must be displayed and the user must be prompted to reenter the number of lines of the Triangle to be shown.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
