why my code is showing TLE?

#include
#include<stdio.h>
using namespace std;
int main()
{
int t,i,j,s;
long int num,n,count5;
scanf("%d",&t);
for(s=0;s<t;s++)
{ count5=0;
scanf("%d",&num);
for(j=num;j>=2;j–)
{
i=2;
n=j;
do
{
if((n%i)==0)
{
if(i==5)
{
count5++;
}
n=n/i;
}
else
i++;

   }
   while(n!=1);


 }
 printf("%d",count5);
 }
 return 0;	

 }

Looks like you are trying to solve FCTRL. The simplest thing i can say is your algorithm is not optimal. It has a complexity of O(N) whereas expected complexity is O(log(N)) (Screams Division!!). The hints i can give you is that observe the number of times 5 divides the numbers like 4,5,6 and 24,25,25 and 124,125,126.

Also you should be printing each answer on a new line.

//