Problem:- Write a program to find the number of zeroes at the end of n! i.e. the number of trailing zeroes in the factorial of a number.
Solution:-
#include<stdio.h>
int main()
{
int n,count=0,i;
scanf("%d",&n);
for(i=5;n/i>=1;i*=5)
count+=n/i;
printf("No. of zeroes at the end of %d! are:-%d\n",n,count);
return 0;
}
Thanx
ReplyDeleteThanx
ReplyDelete