#include <iostream>
using namespace std;
int countZeros(int n) {
int count = 0;
while (n >= 5) {
count += n / 5;
n /= 5;
}
return count;
}
int countOnes(int n) {
int count = 0;
for (int i = 1; i <= n; i++) {
int x = i;
while (x > 0) {
if (x % 10 == 1)
count++;
x /= 10;
}
}
return count;
}
int main() {
int n;
cout << "Enter a number: ";
cin >> n;
int zeros = countZeros(n);
int ones = countOnes(n);
cout << "Number of zeros in " << n << "! is: " << zeros << endl;
cout << "Number of ones in " << n << "! is: " << ones << endl;
return 0;
}
02-20
122
04-24