Nonrecursive factorial write a nonrecursive version of the


 (Nonrecursive Factorial) Write a nonrecursive version of the Factorial procedure (Section 8.3.2) that uses a loop. (A VideoNote for this exercise is posted on the Web site.) Write a short program that interactively tests your Factorial procedure. Let the user enter the value of n. If overflow occurs in your loop when calculating each factorial value, your program should display an error message. If no overflow occurs, display the calculated factorial. Following is a sample of the interaction between the user and the program: Enter the value of n to calculate the factorial (-1 to quit): 0 The factorial is: 1 Enter the value of n to calculate the factorial (-1 to quit): 1 The factorial is: 1 Enter the value of n to calculate the factorial (-1 to quit): 5 The factorial is: 120 Enter the value of n to calculate the factorial (-1 to quit): 12 The factorial is: 479001600 Enter the value of n to calculate the factorial (-1 to quit): 13 Error: Calculated value cannot fit into 32 bits Enter the value of n to calculate the factorial (-1 to quit): -1

Solution Preview :

Prepared by a verified Expert
Assembly Language: Nonrecursive factorial write a nonrecursive version of the
Reference No:- TGS0582396

Now Priced at $40 (50% Discount)

Recommended (94%)

Rated (4.6/5)