+ 1
Whats the algorithm for factorial,armstrong number?
3 odpowiedzi
+ 6
Factorial refers to the product of all positive integers that are less than or equal to a specific non-negative integer (n). The factorial of n is denoted as n!
There 5! =5*4*3*2*1
There you have to make recursive function to output it. There will be a base case that when the number is equal or less than 0 it will return 1. Else it will return n*recursivefunction (n-1). That's it.
+ 6
For Armstrong Numbers, see this Challenge.
https://www.sololearn.com/learn/4708/?ref=app
You will just have to split the numbers into digits and then have to raise it to the power of its length and then have to add them.
If the output is same to the number, it is a Armstrong Number.
+ 1
👍