Whenever I run the program, input 2 for x
2 for y
it will result 4 which is fine, but whenever I put in 2 to power of 3 it outputs 9
when it should output 8 and when I do 3 to power of 2 it outputs 8 when it should give 9. It works for 2^2, 2^4 but not for 2^3. Also 8^8 gives 256
. Is the program written wrong?
/ Start of the main program
Input / Enter the exponent Store y
Subt One
Store Count
Input / Enter the Base
Store x
Store y
Jns Exp
/ Ending the main program
Load Ans
Output
End, Halt
Exp, Hex 0
Loop2, Load Count
Skipcond 800
JumpI Exp
JnS Multiplier
Load Ans
Store x
Load Count
Subt One
Store Count
Jump Loop2
/ Start of the subroutine Multiplier
Multiplier, Hex 0
Load Zero
Store Ans
Loop, Load x
Skipcond 800
JumpI Multiplier
Load Ans
Add y
Store Ans
Load x
Subt One
Store x
Jump Loop
/ Declaration
x, Dec 2
y, Dec 3
Zero, Dec 0
One, Dec 1
Ans, Dec 0
Count, Dec 0