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

Which php mvc framework is best?

1075


How can you execute php script from the command line?

1060


How is session data stored?

1022


Why constructor is not overridden?

1061


How are sessions maintained?

985


What is variable function php?

1109


Explain me is it possible to destroy a cookie?

994


Can you define an argument as a reference type?

1012


How would you open a directory for reading in php?

1056


How many escape sequences are recognized in double-quoted strings?

1045


Declare a new variable in php equal to the number 3;

991


How many different types of messages available in php?

1060


Write down the benefits of php7?

1099


How do I clear my browser session?

1085


Which software is best for php?

1052