Given a number n. The task is to find the unit digit of factorial of given number n.
Answers
Answered by
0
Answer:
Step-by-step explanation:4686
Answered by
0
Answer:
int findDigits(int n)
{
// factorial exists only for n>=0
if (n < 0)
return 0;
// base case
if (n <= 1)
return 1;
// else iterate through n and calculate the
// value
double digits = 0;
for (int i=2; i<=n; i++)
digits += log10(i);
return floor(digits) + 1;
}
Step-by-step explanation:
Similar questions