- <?php
- echo find_fact(4);
-
- function find_fact($number){
- $fact=1;
- for($i=1;$i<=$number;$i++){
- $fact=$fact*$i;
- }
- return $fact;
- }
- ?>
- <?php
- echo find_fact(4);
-
- function find_fact($number){
- $fact=1;
- for($i=1;$i<=$number;$i++){
- $fact=$fact*$i;
- }
- return $fact;
- }
- ?>
First of all, I want to tell you that what is the prime no.
Prime no is the no which can’t be divided by other than 1 and itself.
- <?php
- $no=8;
- $prime=true;
- for($i=2;$i<($no/2);$i++)
- {
- if($no%$i==0){
- $prime=false;
- break;
- }
- }
- if($prime==true){
- echo "<br/>Number is Prime<br/>";
- }
- else{
- echo "<br/>Number is not prime<br/>";
- }
- ?>