Created
May 20, 2020 15:03
-
-
Save unalfaruk/3226dfd2515bcd83acf5924935a24cb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function result = isFactorionNumber(number) | |
result=0; | |
numberArray = num2str(number); | |
sum=0; | |
for i=1:1:length(numberArray) | |
sum=sum+factorial(str2num(numberArray(i))); | |
end | |
if isequal(number,sum) | |
result=1; | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment