Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write the prime number of program?in php

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


Please Help Members By Posting Answers For Below Questions

How to convert a json string to an array in php?

992


What is php static function?

967


What is php artisan tinker?

913


What are the differences between GET and POST methods?

999


Explain me what is the importance of "method" attribute in a html form?

882


How we get ip address of client, previous reference page etc?

919


Do you know how can we check the value of a given variable is a number?

875


What is the advantage of runtime polymorphism?

883


What is meant by ‘passing the variable by value and reference' in php?

935


How to read the entire file into a single string?

932


What is difference between static and constant?

967


What is the use of mysql_real_escape_string() function?

878


How do you create an array in php?

952


How to process the uploaded files?

1050


How to use http headers inside php?

998