11. Factorial Of A Given Number

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 11. Factorial Of A Given Number as PDF for free.

More details

  • Words: 254
  • Pages: 3
Adam’s Engineering College, Paloncha ECE Department –MPI LAB Experiment No.: 11 Page 1 of 3

Year : III/IV B.Tech II Semester

FACTORIAL OF A GIVEN NUMBER

Aim: - To write an assembly language program to find the factorial of the given number. Registers: - Al, BL Description: - Factorial of a given number is found and the result is stored in the pointer. Ports:- None. DATA SEGMENT X DB ? FACT DB 2 DUP(0) DATA ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA, ES: DATA START:

MOV AL, 01 MOV BL, X LOOK: MUL BL DEC BL JNZ LOOK MOV FACT, AL CODE ENDS END START

Lab in-charge

HOD, ECE

Adam’s Engineering College, Paloncha ECE Department –MPI LAB Experiment No.: 11 Page 2 of 3

Year : III/IV B.Tech II Semester

(2) DATA SEGMENT X DB ? FACT DB 2 DUP(0) DATA ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA, ES: DATA START:

MOV AL, 01 MOV BL, X LOOK: JZ NEXT MUL BL JNZ LOOK NEXT: MOV FACT, AL CODE ENDS END START

(3) DATA SEGMENT X DB ? FACT DB 2 DUP(0) DATA ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA, ES: DATA START:

LOOK: Lab in-charge

MOV AL, 01 MOV CL, X JZ NEXT

HOD, ECE

Adam’s Engineering College, Paloncha ECE Department –MPI LAB Experiment No.: 11 Page 3 of 3

Year : III/IV B.Tech II Semester

MUL CL LOOP LOOK NEXT: MOV FACT, AL CODE ENDS END START Result: Factorial of a given number is obtained.

Lab in-charge

HOD, ECE

Related Documents