Write a C program that will do the following:1. Use a Factorial function that you create. The function prototype should be:unsigned long long Factorial(unsigned int n);a. If you do not remember how to...


Write a C program that will do the following:

1. Use a Factorial function that you create. The function prototype should be:

unsigned long long Factorial(unsigned int n);

a. If you do not remember how to do function prototypes and to write functions,

review pages 230-234.

b. Do not use a recursive function.

2. Your main function should call your Factorial function to calculate the factorials for up to

10 integer values that the user enters. Store the numbers entered and their factorials so

that you can print them out later. Use the enter “q to quit” method to terminate this

portion of the program.

a. C uses what is called a short circuit Boolean approach when evaluating compound

logical expressions. This means that it evaluates them left to right and stops when

it determines the value and may not evaluate all of the expressions. For example:

(i

of the expression is false so the complete expression will be false independent of

what the right most expression is.

b. (expr 1 always evaluated) && (expr 2 only evaluated if expression 1 is true).

c. (expr 1 always evaluated) || (expr 2 only evaluated if expression 1 is false).

3. Print out a table of the numbers entered and their factorial values in 2 neatly aligned

columns.

4. Use a loop to determine the value of n that will produce the largest n! value that could be

stored in an unsigned short variable. Print out the maximum value for an unsigned short

variable, the value of n that will produce the largest n! that is less than or equal to the

maximum value for an unsigned short variable.

a. The constant USHRT_MAX contained in limits.h provides the maximum value

for an unsigned short variable.

Remember that n! means 1*2*3*…*(n-1)*n.
Oct 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here