Number of digits in N!

this is the problem statement:

my soln:

its showing correct output for all the inputs i am trying,
but when submitted its showing sigsegv please help me out here,
i dont think there is any problem with logic,
please help me to find out whats the problem