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
Why php is used with mysql?
Is php a mvc?
What are php applications?
How check field is empty or not in php?
Is php harder than javascript?
What is difference between echo and print_r in php?
Is age interval or ordinal?
How to write the form tag correctly for uploading files?
What are escaping characters?
Tell me is it possible to remove the html tags from data?
Can constructor be private in php?
Why print_r is used in php?
How can we extract string "pcds.co.in" from a string "https://info@pcds.co.in" using regular expression of php? More on reg can you explain
How do I run a php program in dreamweaver?
Is it possible multiple inheritance in php?