Saturday, July 26, 2014

Make a Simple Calculator with Notepad

Notepad may be a really innocent-looking application that comes stuck with every Microsoft Windows Operating System, but this simple looking application is a little more useful too than just writing texts, you can make simple .bat programs using and can easily compile HTML documents via it.





Today we will tell you to how to compile a simple calculator using notepad, here is what you have to do:

  1. Launch Notepad. You can do that easily by press Windows Key + R and typing notepad and press Enter key.

  2. Copy the following code and paste it in the 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 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 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!

Now save that notepad file with any name but with .bat extension, (for example, calculator.bat, calc.bat).

Now open that .bat file and start using your simple calculator. :)

About the Author

asd

Author & Editor

Hi there! I am a 16 years old boy living in Pakistan. My favorite passtimes include blogging, tweeting, and gobbling down my favorite dishes. Besides this, I also love to play table tennis. Want to ask me a question? You can do so by clicking here.

Post a Comment

 
The Web Saga © 2013-2015 Designed by Haroon Rasheed