write a nonrecursive version of the 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

Request for Solution File

Ask an Expert for Answer!!
Assembly Language: write a nonrecursive version of the factorial
Reference No:- TGS0410959

Expected delivery within 24 Hours