time limit exceded

I wrote this code(which I already corrected 2-3 times) in java and when I submit it I get TLE error.
Now how can I reduce its execution time ? If anyone could tell me it will be of great help with not just this question but other questions as well.
Thank you.

Question:http://www.codechef.com/problems/FCTRL

My code:
/* package codechef;

import java.util.;
import java.lang.
;
import java.io.*;

class Codechef

{

public static void main (String[] args) throws java.lang.Exception

{

int ctr;

	double i,t,n;

	Scanner input = new Scanner(System.in);

	t= input.nextDouble();

	while(t!=0)

	{n=0;ctr=0;


		n=input.nextDouble();
		

		for(i=1;i<=n;i++)

		{

			//checking for all the powers of 5,thought it would take less time than a loop

			if(i%5==0)

				{ctr++;}

			 if(i%25==0)

				ctr++;

			 if(i%125==0)

				ctr++;

			 if(i%625==0)

				ctr++;

			 if(i%3125==0)

				ctr++;

			 if(i%15625==0)

				ctr++;

			 if(i%78125==0)

				ctr++;

			 if(i%390625==0)

				ctr++;

			 if(i%1953125==0)

				ctr++;

			 if(i%9765625==0)

				ctr++;

			

		}

		System.out.println(ctr);

    }

	

}

}

your conditional statements are leading to TLE.

the answer is just the floor value of ∑(N/5<sup>i</sup>) where i ∈ [1,12].