2018-03-18 23:24:55 +03:00
|
|
|
/*
|
2020-05-29 23:23:24 +03:00
|
|
|
programme for computing number of zeroes at the end of factorial of a given
|
|
|
|
number n
|
2018-03-18 23:24:55 +03:00
|
|
|
*/
|
2020-06-28 18:25:37 +03:00
|
|
|
#include <math.h> //including math.h header file to use pow function
|
2020-05-29 23:23:24 +03:00
|
|
|
#include <stdio.h>
|
2018-03-18 23:24:55 +03:00
|
|
|
int main()
|
|
|
|
{
|
2020-05-29 23:23:24 +03:00
|
|
|
int i, n, test = 0, count = 0;
|
|
|
|
// taking input number n
|
|
|
|
scanf("%d", &n);
|
|
|
|
|
|
|
|
// looping from 1 till loop break
|
|
|
|
for (i = 1;; i++)
|
2018-03-18 23:24:55 +03:00
|
|
|
{
|
2020-05-29 23:23:24 +03:00
|
|
|
test =
|
|
|
|
n /
|
|
|
|
pow(5,
|
2020-06-28 18:25:37 +03:00
|
|
|
i); // division of n by ith power of 5(storing in integer form)
|
2020-05-29 23:23:24 +03:00
|
|
|
if (test !=
|
2020-06-28 18:25:37 +03:00
|
|
|
0) // condition for zeroes at end corresponding individual ith case
|
2018-03-18 23:24:55 +03:00
|
|
|
{
|
2020-05-29 23:23:24 +03:00
|
|
|
count = count + test;
|
2018-03-18 23:24:55 +03:00
|
|
|
}
|
2020-05-29 23:23:24 +03:00
|
|
|
else
|
2020-06-28 18:25:37 +03:00
|
|
|
break; // break the loop for if test=0
|
2018-03-18 23:24:55 +03:00
|
|
|
}
|
2020-05-29 23:23:24 +03:00
|
|
|
printf("%d\n", count);
|
2018-03-18 23:24:55 +03:00
|
|
|
return 0;
|
|
|
|
}
|