×

# why does this factorial program does not return the number of trailing zeroes for 25! as 6?

 0 http://www.codechef.com/viewsolution/1017061 when I give input as follows: 5 5 10 15 20 25  the output I get is: 1 2 3 4 0 import java.util.Scanner; class Factorial { public static void main(String args[]) { int i,n; Scanner sc= new Scanner(System.in); n=sc.nextInt(); long a[]=new long[n]; long cnt[]=new long[n]; for(i=0;i

 1 does 25! (=15511210043330985984000000) fit in a long in Java ? answered 05 May '12, 21:32 3.4k●2●19●55 accept rate: 20%
 0 @sds1810 : this is not the correct way of solving it....you should look carefully what factors contribute to making a zero in a factorial :) answered 26 Mar '16, 09:58 11 accept rate: 0%
 0 may be some precision problem is present check it!!! answered 26 Mar '16, 11:17 0★kshiti1 1 accept rate: 0%
 0 answered 02 Sep '17, 17:53 16 accept rate: 10%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×175

question asked: 05 May '12, 20:38

question was seen: 1,256 times

last updated: 02 Sep '17, 17:53