Computer Science, asked by gnandini2845, 1 year ago

Determine whether n is a factorial number or not using java

Answers

Answered by duragpalsingh
1
Hey there! ☺☻☺

To Determine whether the number if factorial or not:

int findFact(int test){
for(int i=1, int sum=1; sum <= test; i++){
if(sum == test)
return i; //Factorial of i
        sum *= i; // factorial number found
    }
return 0; //No factorial found
}

Hope It Helps You! ☺☻☺
Similar questions