Cod sursa(job #1793888)

Utilizator shantih1Alex S Hill shantih1 Data 31 octombrie 2016 17:25:32
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
#include <cmath>
using namespace std;

int n, k, i, j, s=1, p;
long long x, nf;
int main() {
    
    cout << "p = ";     cin >> p;
    
    x = pow ( 10 , p );
    
    nf = 1;
    n = 1;
    
    if ( p > 0 )
    {
        while ( nf % x != 0 )
        {
        
            nf = nf * n;
        
            n = n + 1;
            k = k + 1;
        }
        
        cout << k << "\n";
    }
    
    else cout << 1 << "\n";
    
    return 0;
}