Q:

# Write a C++ program to find the number of trailing zeroes in a given factorial

Write a C++ program to find the number of trailing zeroes in a given factorial

Input: n = 4
Output: 0
Input: n = 6
Output: 1

Sample Output:

```Number of trailing zeroes of factorial 4 = 0

Number of trailing zeroes of factorial 6 = 1

Number of trailing zeroes of factorial 7 = 1

Number of trailing zeroes of factorial 10 = 2
```

``````#include <iostream>
using namespace std;

int trailing_Zeroes(int n) {
int number = 0;
while (n > 0) {
number += n / 5;
n /= 5;
}
return number;
}

int main(void)
{
int n = 4;
cout << "\nNumber of trailing zeroes of factorial " << n << " = " << trailing_Zeroes(n) << endl;
n = 6;
cout << "\nNumber of trailing zeroes of factorial " << n << " = " << trailing_Zeroes(n) << endl;
n = 7;
cout << "\nNumber of trailing zeroes of factorial " << n << " = " << trailing_Zeroes(n) << endl;
n = 10;
cout << "\nNumber of trailing zeroes of factorial " << n << " = " << trailing_Zeroes(n) << endl;
return 0;
}``````