answersLogoWhite

0


Best Answer

Aim: - To write an assembly language program to find sum of cubes of given 'n' numbers.

1

2

3

4

5

6

7

8

9

MOV CL, NUM

MOV SUM, 00

L1: MOV AL, CL

MUL AL

MUL CL

ADD AL, SUM

MOV SUM, AL

LOOP L1

END

Result: Sum of cubes of first 'n' natural numbers is obtained.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

TITLE Calculating a Factorial (Fact.asm)

; This program uses recursion to calculate the

; factorial of an integer.

; Last update: 06/01/2006

INCLUDE Irvine32.inc

.code

main PROC

push 12 ; calculate 12 factorial

call Factorial ; calculate factorial (eax)

ReturnMain:

call WriteDec ; display it

call Crlf

exit

main ENDP

Factorial PROC

push ebp

mov ebp,esp

mov eax,[ebp+8] ; get n

cmp eax,0 ; n < 0?

ja L1 ; yes: continue

mov eax,1 ; no: return 1

jmp L2

L1: dec eax

push eax ; Factorial(n-1)

call Factorial

; Instructions from this point on execute when each

; recursive call returns.

ReturnFact:

mov ebx,[ebp+8] ; get n

mul ebx ; ax = ax * bx

L2: pop ebp ; return EAX

ret 4 ; clean up stack

Factorial ENDP

END main

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

MOV AH,1 ; for taking input from the user

INT 21H ;interrupt

XOR AH, AH ;used xor to make ah=0

SUB AX,30H ; ascii adjustment

MOV CX,AX ; copy the value of ax into cx

MOV AX,1 ;make ax=1

GO:

MUL CX ;multiply the content of AL with CH

LOOP GO ; loop will decrement the value of CX by one

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program in 8086 assembly language to generate the factorial of given number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Which program translate assembly language into machine language?

Assembly langue is translated into machine language by an assembler.


A program for assembly language for traffic light control?

an assembly language program of traffic light


What is assembly program?

An assembly program is a machine-dependent program written in a low-level symbolic code known as assembly language.


Reserved word in assembly language program?

use of reserved word in assembly language


Example of Password program code in assembly language?

How to write the program un Assembly language to set a password for personal computers?


Assembly language program for string concatenation using 8086 microprocessor?

write program to concatenating two sting in 8086 assembly language


Write an assembly language program to generate a square wave of 10khz and 5Mhz clock?

You will need to have a little bit of computer science knowledge. This will help you to make the programing.


Write a program in 8086 assembly language to draw a circle?

You need an 8086 assembly language pencil.


What translation programs converts assembly language programs to object program?

The only translation program that converts assembly language to machine code is an assembler.


Does machine operation generate odject code during assembly?

You cannot generate machine code from assembly language without running a program (an assembler). Therefore the machine that generates the machine code must be operational and must be running an assembler program that is appropriate to the target platform. The machine code output from the assembler can then be loaded onto the target platform and executed.


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


What application will be used to convert an assembly language source program into machine language?

An Assembler converts assembly language instructions into machine language.