Prime Number Checker Using Notepad

by Abdur RaafiT in Circuits > Computers

912 Views, 2 Favorites, 0 Comments

Prime Number Checker Using Notepad

PNC1.JPG
PNC2.JPG
PNC3.JPG

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.

Open or RUN Notepad

PNC4.JPG

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

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

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

Done

How to make a prime number checker in notepad

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#