Hey Guys! marmig0404 here and i just wanted to share my home made simple arithmetic calculator.

Here is the code, just please don't copy and take it as your own. Thank you!

@echo off
title Calculator
color 0a
echo Welcome to The Basic Arithmetic Calculator
ping localhost -n 3 >nul

cls
ping localhost -n 2 >nul
cls
ping localhost -n 2 >nul
cls
ping localhost -n 2 >nul
cls
ping localhost -n 2 >nul
cls
ping localhost -n 2 >nul
ping localhost -n 2 >nul
color 0a

:START
cls
echo What Type of Math would you like to do?
echo Add, Subtract, Multiply, or Divide.
set /p math=
IF '%math%' == 'Subtract' GOTO SUB
IF '%math%' == 'subtract' GOTO SUB
IF '%math%' == 'Multiply' GOTO MULTIPLY
IF '%math%' == 'multiply' GOTO MULTIPLY
IF '%math%' == 'Divide' GOTO DIVIDE
IF '%math%' == 'divide' GOTO DIVIDE
Exit

Cls
pause
exit

:SUB
Cls
pause
exit

:MULTIPLY
Cls
GOTO NUMBERSMULTIPLY
pause
exit

:DIVIDE
Cls
GOTO NUMBERSDIVIDE
pause
exit

echo What is the First Number you would like to Add?
set /p number1=
cls
echo What is the Second Number you would like to Add?
set /p number2=
cls

exit

echo What is the First Number you would like to Subtract?
set /p number1=
cls
echo What is the Second Number you would like to Subtract?
set /p number2=
cls
GOTO SUB2
exit

:NUMBERSMULTIPLY
echo What is the First Number you would like to Multiply?
set /p number1=
cls
echo What is the Second Number you would like to Multiply?
set /p number2=
cls
GOTO MULTIPLY2
exit

:NUMBERSDIVIDE
echo What is the First Number you would like to Divide?
set /p number1=
cls
echo What is the Second Number you would like to Divide?
set /p number2=
cls
GOTO DIVIDE2
exit

Set /A result = %number1% + %number2%
Pause
GOTO START
exit

:SUB2
Set /A result = %number1% - %number2%
pause
GOTO START
exit

:MULTIPLY2
Set /A result = %number1% * %number2%
pause
GOTO START
exit

:DIVIDE2
Set /A result = %number1% / %number2%
pause
GOTO START
exit

Thats it!
<p>lol idk why i share this.</p><p>@echo off</p><p>:again</p><p>color a</p><p>cls</p><p>echo Type an equation.</p><p>set /p x=</p><p>echo %x%</p><p>&quot;%x%&quot;=&quot;%x%&quot; goto done</p><p>:done</p><p>color a</p><p>cls</p><p>Set /A result = %x%</p><p>echo %result%</p><p>timeout /t 5</p><p>cls</p><p>color 6</p><p>echo 1:again</p><p>echo 2:exit</p><p>set /p op=</p><p>if %op%== 1 goto again</p><p>if %op%== 2 goto exit </p><p>:exit</p><p>exit</p>
<p><a href="https://www.instructables.com/id/Batch-Calculator-4/" rel="nofollow">https://www.instructables.com/id/Batch-Calculator-4...</a></p><p>here you can find mine</p>
<p>this is bad because you can use: </p><p>set /p sum= </p><p>set /a ans=%sum%</p><p>so you can use all the functions</p>
<p>I made one myself. I like it. just copy and paste it and tell me if you like it or if it sucks.</p><p>--------------------------------------------------------------------------------------------------</p><p>@echo off</p><p>:start</p><p>cls</p><p>echo Welcome to Clown's official calculator Batch file.</p><p>pause</p><p>goto next</p><p>:next</p><p>cls</p><p>echo Type an equation.</p><p>echo Like this: 8 * 8 (replace * with the function you wish to use)</p><p>set /p x=</p><p>echo %x%</p><p>&quot;%x%&quot;=&quot;%x%&quot; goto done</p><p>:done</p><p>cls</p><p>Set /A result = %x%</p><p>echo %result%</p><p>pause</p><p>exit</p>
<p>It's good! except, you have a little bit of extra stuff.</p><p>here:</p><p>:start</p><p>@echo off</p><p>color 0A</p><p>cls</p><p>echo Welcome to Clown's official calculator Batch file.</p><p>pause</p><p>cls</p><p>echo Type an equation.</p><p>echo Like this: 8 * 8 (replace * with the function you wish to use)</p><p>set /p x=</p><p>cls</p><p>echo %x%</p><p>pause</p><p>echo Again, or No?</p><p>1: Again</p><p>2: No</p><p>set /p answer =</p><p>if %answer% == 1 goto :start</p><p>if %answer% == 2 exit</p><p>There you go!</p>
<p>hey just wanted to share my own I am kind of a Newbee In batch programmingan here is a small as I can get the programm :</p><p>@echo off</p><p>mode con: cols=100 lines=20</p><p>Title Basic 2 numbers operations</p><p>:N</p><p>echo *****Basic Calculator By Auto5k*****</p><p>echo choose an operation {1=addition ;2=substraction ;3=multiplication ;4=division}</p><p>echo to exit the program enter {5}</p><p>set /p m=</p><p>if %m%==1 set l=+</p><p>if %m%==2 set l=-</p><p>if %m%==3 set l=*</p><p>if %m%==4 set l=/</p><p>if %m%==5 GOTO E</p><p>GOTO A</p><p>:A</p><p> set /p one=enter your first number</p><p> set /p sec=enter your second number</p><p> set /a rep=%one%%l%%sec%</p><p> echo ****%rep%****</p><p> pause</p><p>GOTO N</p><p>:E</p>
<p>This one is the most compact version of this calculator I could come up with:</p><p>@echo off</p><p>title calculator</p><p>color 0a</p><p>:1</p><p>cls</p><p>echo.</p><p>echo ===========================</p><p>echo claculator simplified</p><p>echo ===========================</p><p>echo.</p><p>set /p num1= number 1: </p><p>set /p ope= operation: </p><p>set /p num2= number 2: </p><p>if %ope%== + goto add</p><p>if %ope%== - goto sub</p><p>if %ope%== * goto mult</p><p>if %ope%== / goto div</p><p>goto 1</p><p>:add</p><p>cls</p><p>set /a result = %num1% + %num2%</p><p>echo %num1%%ope%%num2% = %result%</p><p>pause</p><p>goto 1</p><p>:sub</p><p>cls</p><p>set /a result = %num1% - %num2%</p><p>echo %num1%%ope%%num2% = %result%</p><p>pause</p><p>goto 1</p><p>:mult</p><p>cls</p><p>set /a result = %num1% * %num2%</p><p>echo %num1%%ope%%num2% = %result%</p><p>pause</p><p>goto 1</p><p>:div</p><p>cls</p><p>set /a result = %num2% / %num2%</p><p>echo %num1%%ope%%num2% = %result%</p><p>pause</p><p>goto 1</p>
<p>here is a better one with history of calculations;<br>@echo off<br>title Calculator<br>Cls<br>color A<br>echo.<br>echo.<br>echo ====================<br>echo = Start Calculator =<br>echo ====================<br>echo.<br>echo Press Any Key To Start...<br>pause &gt;nul<br>echo.<br>echo.<br>echo ------------------------<br>echo Welcome To Calculator!!!<br>echo ------------------------<br>echo.<br>echo _________<br>echo Made<br>echo By<br>echo NinjaXMAt<br>echo _________<br>echo.<br>echo.<br>echo.<br>echo.<br>echo How To Use?<br>echo For Calculator Type 1.<br>echo Note ** You can only change colour before using calculator!!!<br>echo Note ** To Reset, Press r once and hit enter after calculating digits!!! <br>echo --Instructions--<br>echo Enter Two or More Digits with Special Characters like;<br>echo &quot;+&quot; For &quot;Addition&quot;<br>echo &quot;-&quot; For &quot;Subtraction&quot;<br>echo &quot;*&quot; For &quot;Multiplication&quot;<br>echo &quot;/&quot; For &quot;Division&quot;<br>echo For Calculator Colour, Type red,green or normal!!! <br>:menus<br>echo Directory: %CD%<br>echo =========<br>echo = Menus =<br>echo =========<br>echo Type;<br>echo {1} <br>echo {red}<br>echo {green}<br>echo {normal}<br>set /P CMD=Enter Command: <br>if &quot;%CMD%&quot; == &quot;red&quot; goto red<br>if &quot;%CMD%&quot; == &quot;green&quot; goto green<br>if &quot;%CMD%&quot; == &quot;normal&quot; goto normal<br>if &quot;%CMD%&quot; == &quot;Red&quot; goto red<br>if &quot;%CMD%&quot; == &quot;Green&quot; goto green<br>if &quot;%CMD%&quot; == &quot;Normal&quot; goto normal<br>if &quot;%CMD%&quot; == &quot;r&quot; goto Reset<br>if &quot;%CMD%&quot; == &quot;R&quot; goto Reset<br>if &quot;%CMD%&quot; == &quot;%CMD%&quot; goto 1<br><br>%CMD%<br>cd C:\<br>goto menus <br><br>:red<br>color 0c<br>goto menus<br><br>:green<br>color 0a<br>goto menus<br><br>:normal<br>color 07<br>goto menus<br><br>:1<br>echo Input Digit<br>set /p Digit=<br>set /a ans=%Digit%<br>echo Digits Entered=&quot;%Digit%&quot;&gt;&gt;Log.txt<br>echo Ans=&quot;%ans%&quot;&gt;&gt;Log.txt<br>echo.<br>echo Ans=%ans%<br>set /p reset=<br>if &quot;%reset%&quot;==&quot;r&quot; goto Reset <br>goto 1<br>:Reset<br>Cls<br>echo Input Digit<br>set /p Digit=<br>set /a ans=%Digit%<br>echo Digits Entered=&quot;%Digit%&quot;&gt;&gt;Log.txt<br>echo Ans=&quot;%ans%&quot;&gt;&gt;Log.txt<br>echo.<br>echo Ans=%ans%<br>set /p reset=<br>if &quot;%reset%&quot;==&quot;r&quot; goto Reset <br>goto 1<br>1.create a folder<br>2. create another folder inside it<br>3. create a shortcut of batch file<br>4. put it outside of 2nd folder(in first folder)<br>5. Launch It </p>
<p>sorry steps 1-5 are done after pasting code and saving it as batch</p>
<p>THIS IS A MUCH SIMPLER CALCULATOR </p><p>@echo off <br>title Batch Calculator by Thomas.R <br>color 0d <br>:top <br>echo -------------------------------------------------------------- <br>echo Welcome to Batch Calculator by Thomas.R <br>echo -------------------------------------------------------------- <br>echo. <br>set /p sum= <br>set /a ans=%sum% <br>echo. <br>echo = %ans% <br>echo -------------------------------------------------------------- <br>pause <br>cls <br>echo Previous Answer: %ans% <br>goto top <br>pause <br>exit</p>
<p>This code is shorter:</p><p>@echo off</p><p>title calculator</p><p>color 0a</p><p>:calculator</p><p>cls</p><p>set /p a=The first number:</p><p>set /p op=Operation:</p><p>set /p b=The second number:</p><p>set /a c=a%op%b</p><p>echo The answer is %c%</p><p>pause&gt;nul</p><p>goto calculator</p>
<p>Thumb up for the effort, but this solution is terrible, even for a batch.<br>Same thing, easier,faster, much less code, and you could calculate whole series of numbers:<br><br>@ECHO OFF<br>COLOR a<br>TITLE Simple Batch Calculator<br>:START<br>CLS<br>ECHO.<br>ECHO. %RESULT%<br>ECHO.<br>SET/p input=&quot;Let's calculate this: &quot;<br>SET/a calc=%input%<br>SET RESULT=%input%^=%calc%<br>GOTO START^=%calc%<br>GOTO START<br><br>Before everything you could just create legend about functions...</p>

13,718views

5favorites