### PHP PROGRAM TO CHECK PRIME NUMBER OR NOT - STUDENTSBLOG100 PHP TUTORIAL

Logic is same for all programs and only programming statements are different. Here we have given php programming logic to find given number is prime or not.

What is prime Number:
• A Prime Number can be divided evenly only by 1, or itself.
• For example : 5 can only be divided by 1 or 5, so it is a prime number.
• But 6 can be divided by 1, 2, 3 and 6 so it is NOT a prime number.
Prime Number Programming Logic:
• We should do modulo operation for the input number from 1 to input number. ie) 3 % 1 == 0 , 3 % 2 == 1 and 3 % 3 == 0.
• Each and every prime number will get two '0' modulo result.
• So, each time when modulo result occurs 0, increment the count variable, ie) count++
• After that check the condition that, if count variable == 2, input number is prime else not a prime number
Prime Number PHP program:
Output:
3 is a Prime number

Previous
Next Post »

karthik anu

Nice it seems to be good post... It will get readers engagement on the article since readres engagement plays an vital role in every blog.. i am expecting more updated posts from your hands.
iOS Training in Chennai
Android Training in Chennai
php Training in Chennai

john stany

I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.
Android App Development Company

Sharon Sandy

great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
web design Company
web development Company
web design Company in chennai
web development Company in chennai
web design Company in India
web development Company in India

Sharon Sandy

great and nice blog thanks sharing..I just want to say that all the information you have given here is awesome...Thank you very much for this one.
web design Company
web development Company
web design Company in chennai
web development Company in chennai
web design Company in India
web development Company in India

john stany

Being new to the blogging world I feel like there is still so much to learn. Your tips helped to clarify a few things for me as well iOS App Development Company
iOS App Development Company

it is really amazing...thanks for sharing....provide more useful information...
Mobile app development company

it is really amazing...thanks for sharing....provide more useful information...
Mobile app development company

louis philip

You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...
Fitness SMS
Fitness Text
Salon SMS
Salon Text
Investor Relation SMS
Investor Relation Text