Cod sursa(job #1893398)

Utilizator joitamihnea1999Joita Mihnea Ioan joitamihnea1999 Data 25 februarie 2017 17:43:30
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.65 kb
#include <fstream>

using namespace std;

int main()
{
 int nr=1,p,k=1,c,zerouri=0,x;

    ifstream f("fact.in");
    ofstream g("fact.out");

    f>>p;
    while (zerouri!=p)
    {
        zerouri=0;
        nr=nr*k;

        c=nr;

        while (c!=0)
        {
            x=c%10;

            if (x==0)
                {
                zerouri++;
                }

            if (x!=0)
                {
                break;
                }

            c/=10;
        }

        if (zerouri==p)
        {
            g<<k;
        }
                k++;
    }
    f.close();
    g.close();
    return 0;
}