Wednesday, May 13, 2015

How To Create Your Own Command Prompt Calculator?

Have you wanted to make calculations in command prompt? Well now you can make your own calculator to quickly solve a simple mathematical problem using notepad and command prompt.

To make calculator using Microsoft Command Prompt and notepad, follow these steps.

1. Click the Start button, type Notepadin the Search box of the Start menu, and choose Notepad from the menu to open the Notepad.

2. Copy the following code to the Notepad:

@echo off
:start
echo Enter your choice
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 enter 2 numbers you wish to add
set /p num1=
set /p num2=
echo Sum of %num1%+%num2%?
pause
set /a Answer=%num1%+%num2%
echo %Answer%
pause
goto start
 :b
echo Subtraction
echo Please choose the 2 numbers you wsh 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 enter 2 numbers you wish to multiply
set /p num1=
set /p num2=
echo multiplication of %num1%*%num2%?
pause
set /a Answer=%num1%*%num2%
echo %Answer%
pause
goto start
 :d
echo Division
echo Please enter 2 numbers you wish to divide
set /p num1=
set /p num2=
echo Division of %num1%/%num2%?
pause
set /a Answer=%num1%/%num2%
echo %Answer%
pause
goto start
 :e
echo. Done!



3. Go to file and save as file with .bat extension and Save as type box to All Files and then click save.


4. Double click on the file and Follow the simple instructions to get your desired result.

Share:

0 comments:

Post a Comment