Determine whether n is a factorial number or not using java
Answers
Answered by
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! ☺☻☺
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
English,
8 months ago
English,
8 months ago
Accountancy,
8 months ago
Accountancy,
1 year ago
Math,
1 year ago