Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to Calculate power(a,b) i.e a^b

Posted By: Adalgisal Fischer     Category: Assembly Language     Views: 20517

A Program to Calculate power(a,b) i.e a^b.

Code for Program to Calculate power(a,b) i.e a^b in Assembly Language

.MODEL SMALL
.DATA
        BASE    DB      ?
        POW     DB      ?
        NL1     DB      0AH,0DH,'ENTER BASE:','$'
        NL2     DB      0AH,0DH,'ENTER POWER:','$'
.CODE

MAIN    PROC

        MOV AX,@DATA
        MOV DS,AX

ENTER_BASE:


        LEA DX,NL1
        MOV AH,09H
        INT 21H

        MOV AH,01H
        INT 21H
        SUB AL,30H
        MOV BL,AL

        MOV BASE,AL

ENTER_POWER:

        LEA DX,NL2
        MOV AH,09H
        INT 21H

        MOV AH,01H
        INT 21H
        SUB AL,30H

        MOV CL,AL
        DEC CL
        MOV AX,00
        MOV AL,BASE
LBL1:

        MUL BL
        LOOP LBL1

        MOV CL,10
        DIV CL
        ADD AX,3030H
        MOV DX,AX

        MOV AH,02H
        INT 21H
        MOV DL,DH
        INT 21H

        MOV AH,4CH
        INT 21H

MAIN    ENDP
        END     MAIN


OUTPUT
***********

Z:\assembly\SYSTEM~1\AS1>ex12

ENTER BASE:3
ENTER POWER:3
27
Z:\assembly\SYSTEM~1\AS1>
  
Share: 


Didn't find what you were looking for? Find more on Program to Calculate power(a,b) i.e a^b Or get search suggestion and latest updates.

Adalgisal Fischer
Adalgisal Fischer author of Program to Calculate power(a,b) i.e a^b is from Frankfurt, Germany.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!