Tuesday, April 25, 2017

How To Make a Calculator by Using Command Prompt in Windows

Make Calculator using Command Prompt in windows

Create your Own Calculator by using Command Prompt in windows is such a creative thing, Just Follow some simple steps and make your own calculator by using Command Prompt CMD.



Follow Some simple steps to create a Calculator by using Command Prompt.

Step 1:  Open Notepad


Make Calculator using Command Prompt in windows

Type in Windows search bar “Notepad” then you’ll get the Notepad in the list of programs.




Step 2:  Paste Below Code in Notepad




@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!





Ads



Step 3:  Save File in Notepad.

Make Calculator using Command Prompt in windows

Save Notepad File by clicking on File>>Save As>>Calculator.bat
.Bat is a File Extension it can’t be changed but you can set any name at the place of Calculator if you want to change the File’s Name.




Step 4: Double Click on the Calculator.bat file and you will get a CMD window.

Make Calculator using Command Prompt in windows






Ads



Step 5:  Follow Instruction as seen in below Screenshot and your answer will be displayed.


Make Calculator using Command Prompt in windows

0 comments:

Post a Comment

Search Posts

Get Post Alert Directly on your Email

What's Trending...!