Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 optionyn 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 :
@echo off
echo "This is addition of two numbers"
set p a"num
set p b"num
set a sa b
echo sum s
pause
Batch file :
@echo off
echo "This is finding the power of a number"
:loop
set p a"num
set p pow"power
if pow LSS goto step
if pow goto step
set a result
set a power
:loop
set a resultresulta
set a powerpower
if power GEQ pow goto step
goto loop
:step
echo "power pow of the number a is result
goto step
:step
echo "power pow of the number a is
goto step
:step
echo "invalid entry"
:step
echo do you want to enter another number
set p optionyn
if option y goto loop
pause
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started