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

Is php secure?

937


What is implode() in php?

1052


What is php glob?

969


What are the differences between GET and POST methods?

1025


Who is the father or inventor of php?

1048


What are the advantages of stored procedures in php?

921


How to get the directory name out of a file path name?

927


How to select a database?

982


What is needed to be able to use image function?

955


What is the function func_num_args() used for?

928


How to make horizonatl menu and vertical menu responsive

2271


What is the delimiter syntax is PHP's default delimiter syntax

1223


What is the use of Mbstring?

934


What are the features of php?

998


Are there regular expressions in php?

892