Source code of determining the facttorial of a given number in 8085

Friday, January 23, 2009

  • Problem:Determine the factorial of a given number.
  • Solution:
The factorial of a number is a value which is equal to the result of the multiplication of the number starting from 1 to the number. Suppose the factorial of 4 is equal to the result of 1*2*3*4 that is 24
  • Determination of Factorial in 8085:
In 8085 programming we will determine the factorial of a number.The source code of this program are given bellow. Just type this code in your 8085 simulator and run the program. The program will determine the factorial of your given number.
  • Program Code:
  1. MVI B 00
  2. MVI C 05
  3. MVI A 00
  4. MVI D 00
  5. MVI E 00
  6. MOV B ,C
  7. DCR B
  8. MOV D,B
  9. ADD C
  10. DCR D
  11. JNZ F008
  12. MOV C,A
  13. MOV A,E
  14. DCR B
  15. JNZ F00A
  16. MOV M, C
  17. HLT
  • About program Code:
In this program C is the given Number.We will determine the factorial of the number C. The out put of the program is shown in the memory.
  • Source Code of the program and Output:

0 comments:

Visitors

PlugIn.ws - Free Hit Counter, Web Site Statistics, Traffic Analysis

  © Blogger template Leaving by Ourblogtemplates.com 2008

Back to TOP