Introduction: Exponents in Batch

Hello! I'm new to instructables, and I wanted to share a small bit of code that allows you to solve for exponents in batch.

Step 1:

@echo off

echo Positive Exponents

set /p num=

set /p power=

set /a "x=1"

set /a "ans=num"

if %num% EQU 0 goto :end

if %power% EQU 0 goto :end

:process

set /a "ans=ans*num"

if %power% GTR 1 set /a "x=x+1"

if %x%==%power% goto :end

if %ans% LEQ 0 goto :end

goto :process

:end

cls

if %ans% GTR 0 echo %num% ^^ %power% = %ans%

if %ans% LEQ 0 echo Error

pause

exit

That's it! If you can make use of this, feel free to change it as much as you like.
See you later!

Comments

author
Batchcc made it!(author)2015-11-11

Thank you so much I have tried to do this for a while

https://www.instructables.com/member/Batchcc?show=I...

:)

author
Batchcc made it!(author)2015-11-11

Thank you so much I have tried to do this for a while

https://www.instructables.com/member/Batchcc?show=I...

:)

author
Governor+Keagan made it!(author)2015-10-28

Thanks for sharing

author
Governor+Keagan made it!(author)2015-10-28

Thanks for sharing

author
DIY+Hacks+and+How+Tos made it!(author)2015-06-28

Nice tutorial. Thanks for sharing.

author
luigimaster13 made it!(author)2015-06-29

Thanks!

About This Instructable

270views

3favorites

More by luigimaster13:Random Password Generator V.1.2Exponents in Batch
Add instructable to: