Skip to content

Instantly share code, notes, and snippets.

@lifez
Created March 24, 2013 13:06
Show Gist options
  • Select an option

  • Save lifez/5231904 to your computer and use it in GitHub Desktop.

Select an option

Save lifez/5231904 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
class main{
public static void main(String[] arg){
Scanner in = new Scanner(System.in);
int limit,ans,p,fact;
limit = in.nextInt();
while (limit>0){
fact = in.nextInt();
ans = 0;
p = 5;
while (fact/p!=0){
ans += fact/p;
p *=5;
}
System.out.print(ans);
System.out.print("\n");
limit--;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment