Time complexity will be O(n log5n ) because.
1. The inner loop is independent of the outer loop. For each value of i It will run log5n each time.
so, for n times it will be = O(n log5n ).
for(i=1;i<=n;i++) =================================== O(n)
{
for(j=1;j<=n;j=5*j) { ==============log
5n
{p = p + n; } }
Because inner loop doesn't depend on the on the outer loop so, directly multiply here O(n log5n ).