trailing zeros in factorial

 


#include <iostream>

#include<cmath>

using namespace std;




int main()

{

    int n;

    cin>>n;

    int zeros=0;

    int i=1;

    while(pow(5,i)<n){

        zeros=zeros+(n/(pow(5,i)));

        i++;

    }

    cout<<zeros;

}


Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings