Question: Invlude all the steps and explanation please. Read and understand the sample batch files posted here. Copy them as save it in your PC as

Invlude all the steps and explanation please.
Read and understand the sample batch files posted here.
Copy them as save it in your PC as files with any name but with a .bat extension. Then run them in windows command prompt with just the name of the file. The power program asks for input of a number and a power (also a number), calculates and outputs the power of the number.
Write a batch program to accept a number as input from the user and calculate the factorial of a number. You must continue to accept input as long as the user enters option(y/n) as 'y' for an input. If the user types 'n' then you can end the program. (You can follow similar approach used in the power program)
Batch File 1:
@echo off
echo "This is addition of two numbers"
set /p a="num1"
set /p b="num2"
set /a s=a + b
echo sum =%s%
pause
Batch file 2:
@echo off
echo "This is finding the power of a number"
:loop
set /p a="num1"
set /p pow="power "
if %pow% LSS 0 goto step1
if %pow%==0 goto step2
set /a result=1
set /a power=0
:loop1
set /a result=%result%*%a%
set /a power=%power%+1
if %power% GEQ %pow% goto step3
goto loop1
:step3
echo "power %pow% of the number %a% is %result%
goto step4
:step2
echo "power %pow% of the number %a% is 1"
goto step4
:step1
echo "invalid entry"
:step4
echo "do you want to enter another number ?"
set /p option="y/n "
if %option%== y goto loop
pause

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!