Calculate & Print the Factorial of a Number using PHP?

How to Expose and Route to a Resource?
How to Expose and Route to a Resource?

आज इस आर्टिकल में हम आपको 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

इसे भी पढ़े – How to Find Largest Number in Array Using PHP?

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *