Bash:
@echo off
title Calculator
color 0a
:main
cls
set /p fn=First Number:
set /p sn=Second Number:
echo Choose Any Operator +, -, *, /, %%
set /p op=Operator:
goto condition
:condition
if %op%==+ (goto add)
if %op%==- (goto sub)
if %op%==* (goto mul)
if %op%==/ (
if %sn%==0 (echo Can't Divide by Zero!) else (goto div)
)
if %op%==%% (goto mod)
:add
set /a addition=%fn%+%sn%
echo %addition%
goto ask
:sub
set /a substraction=%fn%-%sn%
echo %substraction%
goto ask
:mul
set /a multiplication=%fn%*%sn%
echo %multiplication%
goto ask
:div
set /a divition=%fn%/%sn%
echo %divition%
goto ask
:mod
set /a modulus=fn%%sn
echo %modulus%
goto ask
:ask
echo Do you want to do another calculation?
set /p yn=Y/N :
if %yn%==y (goto main) else (exit)
කැමති නමක් දාලා.bat කියලා save කරලා run කරන්න.

Last edited:
