Creating Own Calculator by using Command Prompt in Windows is such a creative thing. I’ll show you How to make a calculator by using Command Prompt in Windows.
This trick will help you in solving maths problems and complex calculations. Trust me, this is an amazing feeling when you create something useful with your own.
This is an Amazing Command Prompt trick to make a calculator with it. Actually, You need to follow some simple steps to create a Calculator by using Command Prompt.
Actually, You need a piece of code that I’ve provided below. Save the code as a Text file with .bat extension and when you double on this file, This file will open the command prompt window.
[TechsableAds]
Then, you just need to follow the steps to know more about How to Make a Calculator by Using Command Prompt in Windows.
How To Make a Calculator by Using Command Prompt in Windows
Step 1: Open Notepad
Type in the Windows search bar “Notepad” then you’ll get the Notepad in the list of programs.
[TechsableAds]
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!
Copy this CMD Calculator code and paste it in a text file with .bat extension. If you don’t know how to create a new file in windows, let me help you.
- Go to Windows Desktop Screen
- Right Click >> New
- Select the Text File
- Paste the code
- Give File a name and save as .bat Extension
[TechsableAds]
Step 3: Save File in Notepad
Save Notepad File by clicking on File>>Save As>>Calculator.bat
The .Bat is a File Extension you can’t be changed but you can set any name at the place of Calculator if you want to change the File’s Name.
[TechsableAds]
Step 4: Double Click on the Calculator.bat file and you will get a CMD Window
After Creating a File, Double click to open it and file will be open in a Command Window just like the above screenshot.
[TechsableAds]
Step 5: Follow Instruction as seen in below Screenshot and your answer will be displayed
You have to choose at least two numbers to do the calculations. See in the above screenshot, if you want to add then press 1 and hit enter.
[TechsableAds]
Then, enter two numbers one by one and hit enter. Just like in Screenshot, I am adding 10+10 so firstly I chose 1 for addition.
After that, I entered 10 and hit enter and again 10 and hit enter. That’s how the command prompt calculator roll.
@echo off
:a
Set /p a=
Set /a a=%a%
Echo %a%
Echo.
Goto a
Isn’t it better?