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
Which php mvc framework is best?
How can you execute php script from the command line?
How is session data stored?
Why constructor is not overridden?
How are sessions maintained?
What is variable function php?
Explain me is it possible to destroy a cookie?
Can you define an argument as a reference type?
How would you open a directory for reading in php?
How many escape sequences are recognized in double-quoted strings?
Declare a new variable in php equal to the number 3;
How many different types of messages available in php?
Write down the benefits of php7?
How do I clear my browser session?
Which software is best for php?