Factorial of numbers in PHP November 17, 2019 <?php $num = 4; $factorial = 1; for($x=$num; $x>=1; $x--) { $factorial = $factorial * $x; } echo "Factorial of $num is $factorial"; ?> Output: Factorial of 4 is 24 Share Get link Facebook X Pinterest Email Other Apps Labels PHP Server Side Share Get link Facebook X Pinterest Email Other Apps Comments
Comments
Post a Comment