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

Int n-unconditional branch instruction-microprocessor, INT N : Interrupt T...

INT N : Interrupt Type N:- In the interrupt structure of 8086/8088, 256 interrupts are distinct equivalent to the types from OOH to FFH. When an instruction INT N is executed,

Multiplication using shift and add instruction, Multiply two numbers by usi...

Multiply two numbers by using shift and rotate instruction

Flag manipulation and processor control instructions , Flag Manipulation an...

Flag Manipulation and Processor Control Instructions These instructions control the functioning of available hardware inside the processor chip. These are categorized into thes

Dma-how dma works-microprocessor, DMA DMA stands for Direct Memory ...

DMA DMA stands for Direct Memory Access It is uses same Address/Data lines on ISA bus It controls the ISA bus instead of the processor ("bus master") Floppy

Write a assembly language subroutine, Write a M68000 assembly language subr...

Write a M68000 assembly language subroutine MULSUM that takes an array named A containing n bytes of positive numbers, and fills two arrays, array B containing n

Compute the fibonacci sequence - assembly program, Compute the Fibonacci se...

Compute the Fibonacci sequence - assembly program: Problem: Fibonacci   In this problem you will write a program that will compute the first 20 numbers in the Fibonacci sequ

Cisc characteristics-microprocessor, CISC Characteristics : The design...

CISC Characteristics : The design of an instruction  set for a computer  might take into consideration  not only machine language constraints,  but  also  the  requirements  i

Bcsl-022, define accounting.briefly explain the accounting concepts which g...

define accounting.briefly explain the accounting concepts which guide the accountant at the recording stage.

Program that will display a list of the decades , Write an assembly languag...

Write an assembly language program that will display (print) a list of the Decades 2010, 2020, 2030... 2100 to the screen using a while loop.

Overview of intel pro-pentium, Overview of Intel Pro-Pentium : The 2 c...

Overview of Intel Pro-Pentium : The 2 chief players in the PC CPU market are Motorola and Intel.  Intel has enjoyed incredible success with its processors since the early 1980

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