Answer Posted / mishra ashutosh
i am assuming that you want to test whether a no is prime or not.
$no=123;//lets say, u can take this value form also using $_POST or $_GET
$flag=0;
for($i=2;$i<$no;++$i){
if($no%$i==0){
$flag=1;
break;
}
}
if($flag==1)
echo "$no is not a Prime No" ;
else
echo "$no is a Prime No" ;
| Is This Answer Correct ? | 18 Yes | 1 No |
Post New Answer View All Answers
How to convert a json string to an array in php?
What is php static function?
What is php artisan tinker?
What are the differences between GET and POST methods?
Explain me what is the importance of "method" attribute in a html form?
How we get ip address of client, previous reference page etc?
Do you know how can we check the value of a given variable is a number?
What is the advantage of runtime polymorphism?
What is meant by ‘passing the variable by value and reference' in php?
How to read the entire file into a single string?
What is difference between static and constant?
What is the use of mysql_real_escape_string() function?
How do you create an array in php?
How to process the uploaded files?
How to use http headers inside php?