Calculate & Print the Factorial of a Number using PHP?

Program:- Calculate & Print the Factorial of a Number using PHP?, php program to find factorial of a number using function, factorial program in php using while loop

Solution – Calculate & Print the Factorial of a Number using PHP

<?php
function fact($n){
	if($n < 0){
	 return -1;
	}
	if($n==0){
		return 1;
	}
	return($n*fact($n-1));
}
echo fact(5);
?>

prime number program in php, 10 php program to find factorial of a number using function, armstrong number in php, reverse number in php, palindrome program in php, prime number program in php using if else

Be the first to comment

Leave a Reply

Your email address will not be published.


*