This program calculate how many digit in factorial of the number in given base
Anyone can just calculate number of digits in decimal, then b=10 always.
Anyone can just calculate number of digits in decimal, then b=10 always.
#include <stdio.h>
#include <math.h>
int main()
{
int number,i,base,digit;
double c,a=0;
printf("Give the base and the number: ");
scanf ("%d%d",&base,&number);
c=log10(base);
for (i=number;i>=1;i--) {
a+=(log10(i))/c;
}
digit=a+1;
printf ("%d\n",digit);
return 0;
}
No comments:
Post a Comment