Created
January 18, 2022 17:19
-
-
Save Arjun2002tiwari/345a1ea6c3e06aeeba5dfb4a42947318 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Factorial{ | |
public static void main(String[] args) { | |
int i=10,num,fact=1,count=0; | |
Scanner sc=new Scanner(System.in); | |
num=sc.nextInt(); | |
int n=num; | |
while(num>0){ | |
fact=fact*num; | |
num--; | |
} | |
while(fact%i==0){ | |
count++; | |
i=i*10; | |
} | |
System.out.println("Number of zeros in factorial of "+n+" is "+count); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment