This program is to make a program that checks whether a number is prime or not
- Start Notepad or Notepad++ on your system
- Type this:
@echo off
:x
set /p num=Enter number:
set /a n=%num%
set /a s=1
:a
set /a s=%s%+1
if %s% equ %n% goto c
set /a a=%n% %% %s%
if %a% equ 0 goto b
goto a
:b
echo Composite
goto x
:c
echo Prime
goto x
- Save it as prime.cmd on desktop and double click the file to start it
No comments:
Post a Comment