C Program for Finding Trailing Zero's in factorial of Given number
Source Code :-
#include<stdio.h>
int ftz(int a){
int cnt = 0;
for(int i = 5; a/i>=1; i *= 5){
cnt += a/i;
}
return cnt;
}
int main(){
int a;
scanf("%d",&a); //60
printf("%d",ftz(a)); //60
}
explanation:-
Comments
Post a Comment