How to Make a Command Prompt Calculator

Open notepad by going to Start> All Programs> Accessories> Notepad., Copy the following code: @echo off  :start Echo Press 1 for Addition echo Press 2 for Subtraction echo Press 3 for Multiplication echo Press 4 for Division echo Press 5 to Quit set...

5 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: Open notepad by going to Start> All Programs> Accessories> Notepad.

    Vista and 7 users can just type "notepad"

    without quotes, into the start menu and hit enter
  2. Step 2: Copy the following code: @echo off  :start Echo Press 1 for Addition echo Press 2 for Subtraction echo Press 3 for Multiplication echo Press 4 for Division echo Press 5 to Quit set /p type= if %type%==1 goto a if %type%==2 goto b if %type%==3 goto c if %type%==4 goto d if %type%==5 goto e  :a echo Addition echo Please choose the 2 numbers you wish to add set /p num1= set /p num2= echo %num1%+%num2%?

    pause set /a Answer=%num1%+%num2% echo %Answer% pause goto start  :b echo Subtraction echo Please choose the 2 numbers you wish to subtract set /p num1= set /p num2= echo %num1%-%num2%? pause set /a Answer=%num1%-%num2% echo %Answer% pause goto start  :c echo Multiplication echo Please choose the 2 numbers you wish to multiply set /p num1= set /p num2= echo %num1%*%num2%? pause set /a Answer=%num1%*%num2% echo %Answer% pause goto start  :d echo Division echo Please choose the 2 numbers you wish to divide set /p num1= set /p num2= echo %num1%/%num2%? pause set /a Answer=%num1%/%num2% echo %Answer% pause goto start  :e echo.

    Done! ,,,
  3. Step 3: Go to File> Save As Change the "Save as type" box to "All Files" Type "anything.bat" into file name and click "Save"

  4. Step 4: Double click on the file and you will get this window:

  5. Step 5: Follow the simple instructions and your answer will be displayed

Detailed Guide

Vista and 7 users can just type "notepad"

without quotes, into the start menu and hit enter

pause set /a Answer=%num1%+%num2% echo %Answer% pause goto start  :b echo Subtraction echo Please choose the 2 numbers you wish to subtract set /p num1= set /p num2= echo %num1%-%num2%? pause set /a Answer=%num1%-%num2% echo %Answer% pause goto start  :c echo Multiplication echo Please choose the 2 numbers you wish to multiply set /p num1= set /p num2= echo %num1%*%num2%? pause set /a Answer=%num1%*%num2% echo %Answer% pause goto start  :d echo Division echo Please choose the 2 numbers you wish to divide set /p num1= set /p num2= echo %num1%/%num2%? pause set /a Answer=%num1%/%num2% echo %Answer% pause goto start  :e echo.

Done! ,,,

About the Author

S

Samuel Clark

Brings years of experience writing about organization and related subjects.

44 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: