Cod sursa(job #1162061)

Utilizator RauliKMarian Raul RauliK Data 31 martie 2014 16:50:29
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <fstream>
using namespace std;
int j, k, l, n, x;
unsigned long long i;
int main ()
{
    j = 1;
    ifstream fin ("fact.in");
    fin >> n;
    fin.close();
    
    for ( i = 1; l < n; i++ )
    {
        j *= i;
        for ( k = j; k > 0; k /= 10 )
        {
            if ( k % 10 == 0 )
            {
                 j /= 10;
                 l++;
            }
            else
            {
                break;
            }
        }
        j = j % 100;
    }
    i--;
    ofstream fout("fact.out");
    fout << i;
    fout.close();
    return 0;
}