Nonrecursive Factorial, Assembly Language

Assignment Help:
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

Related Discussions:- Nonrecursive Factorial

Addsub, Using the AddSub program from Ch3 under c:\Masm615\examples as a re...

Using the AddSub program from Ch3 under c:\Masm615\examples as a reference, write a program that subtracts three 16-bit integers using only registers. Insert a call DumpRegs statem

Write an assembly program to design an array, 1- Write an assembly program ...

1- Write an assembly program that:   a- Defines an array of 10 (word type)elements;   b- Finds out the number of negative elements   c- Calculate the summation of the posi

Project, need some project ideas

need some project ideas

Microprocessor, from pin description it seems that 8086 has 16 address/data...

from pin description it seems that 8086 has 16 address/data lines i.e.AD0_AD15.The physical address is however is larger than 2^16.How this condition can be handled

Dq-dt-assemblers directive-microprocessor, DQ:   Define  Quad word:-  Th...

DQ:   Define  Quad word:-  This directive is taken in use to direct the assembler to reserve 4 words (8 bytes) of memory for the specified variable and can initialise it having

Modes of 8254-microprocessor, Modes of 8254 :   Mode 0 (Inter...

Modes of 8254 :   Mode 0 (Interrupt on Terminal Count)-GATE which value is 1 enables counting and GATE  which value is 0 disables counting, and GATE put not effect on

Program to convert decimal to binary number, Program is written but has err...

Program is written but has errors returning values from the procedure.

Right triangle, code, Assembly Language How to print strings in Right Tria...

code, Assembly Language How to print strings in Right Triangle form?

Write an assembly language program, You are to write an assembly language p...

You are to write an assembly language program called subfaq.s that computes the generalized subfactorial function of nonnegative integer inputs i0 and n. The generalized subfactori

LAB homework, 1. Write a program that calculates the Fibonacci series: 1, 1...

1. Write a program that calculates the Fibonacci series: 1, 1, 2, 3, 5, 8, 13, ….. (Except for the first two numbers in the sequence, each number is the sum of the preceding two n

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd