Write a php program to print factorial of a number

Write a php program to print factorial of a number:
Answer:

$num = 7; 
$factorial = 1; 
for ($x=$num; $x>=1; $x--) 

  $factorial = $factorial * $x; 

echo "Factorial of $num is $factorial"; 
?>


Output:

Factorial of 7 is 5040

Comments

Popular posts from this blog

Solve

Solved practical slips of 12th Computer Science journal

SOLVE QUESTION ANSWERS ON OPERATING SYSTEM .