Plz see this for question.
//The code is giving timing errors: Time limit (1s) exceeded.
//Plz help on how I can make my code faster.
#include <stdio.h>
int calc_fact(n)
{
if(n==1)
return 1;
else
return n*calc_fact(n-1);
}
int main()
{
int n, i, tcs, j, l, m;
long long count, y=((10^9)+7), k;
scanf("%d", &tcs);
int fact[tcs];
int arr[tcs];
for(j=0; j<tcs; j++)
{
scanf("%d", &arr[j]);
}
j=0;
for(m=0; m<tcs; m++)
{
fact[m]=calc_fact(arr[j]);
j++;
}
m=0;
for(l=0; l<tcs; l++)
{
i=1;
count=0;
while(i<=fact[m])
{
if((fact[m])%i==0)
count++;
i++;
}
m++;
k=count%y;
printf("%lld\n", k);
}
return 0;
}