Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Adam’s Engineering College, Paloncha

ECE Department –MPI LAB

Experiment No.: 9 Year : III/IV B.Tech II Semester Page 1 of 1

SUM OF CUBES OF FIRST ‘N’ NUMBERS

Aim: - To write an assembly language program to find sum


of cubes of given ‘n’ numbers.

Registers: - AL, CL

Description: - Sum of cubes of given number ‘n’ is found and


the result is stored in SUM.

Ports:- None.

DATA SEGMENT

NUM DB ?
SUM DB 1 DUP(0)
DATA ENDS

CODE SEGMENT

ASSUME CS: CODE, DS: DATA


START:
MOV CL, NUM
MOV SUM, 00
L1: MOV AL, CL
MUL AL
MUL CL
ADD AL, SUM
MOV SUM, AL
LOOP L1

CODE ENDS
END START
Result: Sum of cubes of first ‘n’ natural numbers is obtained

Lab in-charge HOD, ECE

You might also like