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

Why php is used with mysql?

1013


Is php a mvc?

932


What are php applications?

936


How check field is empty or not in php?

1037


Is php harder than javascript?

1000


What is difference between echo and print_r in php?

880


Is age interval or ordinal?

933


How to write the form tag correctly for uploading files?

961


What are escaping characters?

957


Tell me is it possible to remove the html tags from data?

896


Can constructor be private in php?

1023


Why print_r is used in php?

949


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

982


How do I run a php program in dreamweaver?

1061


Is it possible multiple inheritance in php?

1014