phptutorials

PHP program to check Strong number!

In this post we are going to write a PHP program to check Strong number. Before that if you don’t know what is a Strong number here is a small definition.

What is Strong number?

if sum of the factorial of its digit is equal to number itself is called ‘Strong number’. 

Eg: 145

145 is a strong number.
1! + 4! + 5! = 1+24+120 = 145

Let’s write a PHP program to find if the entered number is a strong number or not.

The above script will return true if the entered number is a Strong number else false.

Just go through the inline comments in the above script to understand what each line is doing.

 

Let’s write the whole script so you can copy paste and test it in your localhost immediately:

I have used Bootstrap CSS to get a nice look and feel.

For your convenience here is the demo of the above script.

demo

Enjoy learning!

Related Posts

Leave a Reply