Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 1 Computing Big Factorials using an array Due Date: 2/13/2023 midnight Develop a program to compute N! using unsigned integer type of array to

Assignment 1

Computing Big Factorials using an array

Due Date: 2/13/2023 midnight

Develop a program to compute N! using unsigned integer type of array to store; for a N from 1 to 99,999,999. The result can be a very long number. For example, the factorial of 50 is:

30,414,093,201,713,378,043,612,608,166,064,768,844,377,641,568,960,512,000,000,000,000

In the main method, you ask user to enter factorial number N to compute and create unsigned integer type of an array with 5000 elements to store result of factorial number. Pass an array to the function by reference so that when execution returns from the function and an array will contain final factorials number. The function will compute N! and store into array with a maximum 6 digits per element.

In order to solve this problem, you will initialize the first element of array that it contains 1! Before computing the factorial requested by the user. The factorial of zero and the factorial of one is one (2! is 2, 3! is 6, 4! is 24etc). You need to design how you want to store number into array from 0 to 5000 element or 5000 to 0 element, which is very important when you design your display method.

Write a method to compute the factorial of a number using the algorithm described in class. This should be as efficient as possible. You should store a maximum 6 digits per element and perform computation for large factorials.

Write a method to display the factorial you computed. As you print the value in each element of array you will need to fill in leading zeros by printing character zeros if the digits in an element of the array (except for the beginning of the number) contains leading zeros. Do not print commas in the numbers as shown above. You can only display 60 characters per line. Print to the screen the factorial number you were computing, the number of digits in the value, and print all the digits in the number that was computed.

After you have printed the results, as the user to input the next integer number to be used to compute a factorial. Terminate the program when the user enters a negative number.

You should find out what is biggest factorial number that your program can compute and how long to finished (time)? (Wire the answer of this question in the comment section at the beginning of the program)

Assignment 1 is Due at 2/13/2023 11:59 PM. Do Not Use Any Global Variables. You need to name your project as BigFactorial and zip the whole project folder as A1-yourName for turn in on blackboard before Due Date.!

CODE NEEDS TO BE IN C#

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions