Imp 5 Answer
Imp 5 Answer
COPY_LOOP:
END ;
2…….
MOV A, M ; Load the factorial of the input number from the table
FACTORIAL_TABLE:
DISPLAY_RESULT:
RETURN:
COMPARE_LOOP:
UPDATE_LARGEST:
STORE_RESULT:
OUTER_LOOP:
LXI D, 2000H ; Load starting address of array into DE for inner loop
INNER_LOOP:
JNC SKIP_SWAP ; Jump if no swap needed (current element >= next element)
SKIP_SWAP:
LXI D, 0000H ; Load the destination address for storing the result
CALCULATE_FACT:
INPUT_NUMBER:
CALC_FACTORIAL:
FACT_ZERO:
FACTORIAL_LOOP:
RETURN:
OUTER_LOOP:
LXI D, 9000H ; Load starting address of numbers into DE for inner loop
INNER_LOOP:
JNC SKIP_SWAP ; Jump if no swap needed (current element <= next element)
SKIP_SWAP: