Starting from:

$20

Program that will help to figure out and display the first twenty numbers of the pattern Solution

James has written a number pattern that begins with 1, 5, 14, and 30. Write a C++ program that will help James to figure out and display the first twenty numbers of the pattern; for each number, its corresponding ordinal number must be displayed as well, in a tabular format (see sample run below). The program will then, at the user’s choice entered at the run time, figures out and displays any particular number, with its corresponding ordinal number, in the pattern. For the user’s interest to find another number, allow the program to loop back continuously for any other element in the pattern to be revealed. Lastly, your full name must be displayed on screen before the ending of the program. Validate your input value so that your program won’t be crashed at run time by any reason. If it crashed there will be no credit, or 0 point. the formula is: number=(n(n+1)(2n+1))/6 and n is the order Sample run: Your output must be similar to the following: The first twenty numbers in the pattern: Order Number 1st 1 2nd 5 3rd 14 4th 30 ... What's the ordered element in the pattern that you wanted to find? (Or enter 0 to end): 31 The 31st element is: 10416 What's the ordered element in the pattern that you wanted to find? (Or enter 0 to end): 4300 The 4300th element is: 741775274 What's the ordered element in the pattern that you wanted to find? (Or enter 0 to end): 52 The 52nd element is: 48230 What's the ordered element in the pattern that you wanted to find? (Or enter 0 to end): 0 GOOD BYE! Programmer: Your Full Name Press key to end ...
Expert Answer

More products