It is a program where we play with peterson numbers.
To check whether user enterd number is peterson or not.
-
A number is said to be a Peterson number if the sum of factorials of each digit of the number is equal to the number itself.
-
Example: 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145
-
Here, the user enter a random number and the program will tell that the entered number is peterson or not.
-
Firstly, the program demands a numerical value from the user.
-
Now, it will check the conditions passing through loops.
-
Number split into each digits.
-
Addiotion with factorial of each digits.
-
-
check addtion and number both are equal or not.
-
print the result according to above condition.
-
Run this program in a proper IDE e.g. Pycharm, VScode ,Jupyter notebook etc or any Online compiler like Repelit.
-
Enter the numbers.
-
The output will show you the series.
- Code
- Output