Introduction: Prime Number Checker Using Notepad

Picture of Prime Number Checker Using Notepad

Hi. I am Abdur Raafi and this is my first instuctables. This thing poped into my head about a prime number checker so people could use it to check a large number if it's prime or not. As i knew programing i thought i would make it myself. after 3 weeks of work i finally succeeded (That doesn't mean you will take 3 weeks too. it was the first time so..) so i thought i would share it with you.

Step 1: Open or RUN Notepad

Picture of Open or RUN Notepad

press the windows key and R at the same time and type notepad and press OK

Step 2: Type or Copy Paste the Code to Notepad

@echo off

color 0a

title Prime_Number_Checker_v.1.2

:setv

cls

echo Enter the number you want to check

set /p value=

set /a cvalue=%value%*1

cls

if %cvalue% equ 0 echo "%value%" is an Invalid Input. Please enter a Positive Integer (1 - infinite)

if %cvalue% gtr 0 goto setvb

pause

goto setv

:setvb

set /a dvalue=(%value%/2)+1

set fvalue=1

set svalue=2

echo Processing... Please wait

goto setp

:setf

set /a fvalue=%fvalue%+1

goto setp

:sets

set fvalue=1

set /a svalue=%svalue%+1

goto setp

:setp

set /a pvalue=%fvalue%*%svalue%

:checka

if %value% equ 1 goto unique

if %svalue% equ %value% goto checkc

:checkb

if %pvalue% equ %value% goto composite

if %fvalue% lss %dvalue% goto setf

if %svalue% lss %dvalue% goto sets

goto prime

:checkc

if %fvalue% equ 1 goto prime

goto checkb

:unique

cls

echo The number is unique

choice /c EX /m "Press E to _Enter another number or X to e_Xit"

if %ERRORLEVEL% equ 1 goto setv

if %ERRORLEVEL% equ 2 exit

:composite

cls

echo %svalue% x %fvalue% = %pvalue%

echo The number is composite

choice /c EX /m "Press E to _Enter another number or X to e_Xit"

if %ERRORLEVEL% equ 1 goto setv

if %ERRORLEVEL% equ 2 exit

:prime

cls

echo The number is prime

choice /c EX /m "Press E to _Enter another number or X to e_Xit"

if %ERRORLEVEL% equ 1 goto setv

if %ERRORLEVEL% equ 2 exit

Step 3: Make Sure

Make sure the command

if %cvalue% equ 0 echo "%value%" is an Invalid Input. Please enter a Positive Integer (1 - infinite)

are in one line

Step 4: Done

Here is a video of it working

You can even download the software at

https://www.dropbox.com/home?preview=Prime_Number_Checker+v.1.0.exe#

Comments

DIY Hacks and How Tos (author)2015-12-24

Clever application for notepad.

About This Instructable

195views

2favorites

License:

Bio: Student at Anandaniketan... Friends call me Tech geek; Love Programming; Arduino Enthusiast;
More by Abdur RaafiT:Making a Simple Led Flasher With NE555Prime Number Checker using notepad
Add instructable to: