I have developed the following code for this problem.It runs perfectly on my system and I have developed it to exactly match the output required.But why its still giving wrong answer.
import java.io.*;
class a
{
public static void main(String args[])
{
int num,count=0,add=0,temp,n;
BufferedReader br=null;
try
{
br=new BufferedReader(new InputStreamReader(System.in));
n=Integer.parseInt(br.readLine());
while(n-->0)
{
num=Integer.parseInt(br.readLine());
if(num>=1&&num<=1000000000)
{
if(num>=5)
{
while(num>5)
{
temp=num/5;
add+=temp;
num=temp;
}
}
else
add=0;
System.out.println(add);
add=0;
}
}
}catch(Exception e)
{
// do nothing;
}
}
}