Simple Calculator
@echo off
title Simple Calculator
color 1f
echo Enter first integer value
set /p i1=
echo Enter second integer value
set /p i2=
echo Enter operator(+,-,/,*)
set /p op=
set/a value=%i1% %op% %i2%
cls
echo Answer is=%value%
pause
exit
@echo off
title Simple Calculator
color 1f
echo Enter first integer value
set /p i1=
echo Enter second integer value
set /p i2=
echo Enter operator(+,-,/,*)
set /p op=
set/a value=%i1% %op% %i2%
cls
echo Answer is=%value%
pause
exit
It is easier to use set /a at the beginning so you don't need to type on 3 different lines.
ReplyDelete@echo off
title Batch Calculator by seJma
color 1f
:top
echo --------------------------------------------------------------
echo Welcome to Batch Calculator by seJma
echo --------------------------------------------------------------
echo.
set /p sum=
set /a ans=%sum%
echo.
echo = %ans%
echo --------------------------------------------------------------
pause
cls
echo Previous Answer: %ans%
goto top
Yeah that's also a great code.
ReplyDelete