Cod sursa(job #1493496)

Utilizator rotti321Rotar Mircea rotti321 Data 29 septembrie 2015 15:05:05
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.79 kb
#include <iostream>
#include <fstream>

using namespace std;

//citire date 29.09.2015

ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
    int p,n,gasit,produs,t;
    int k=0;
    f>>p;
    gasit=0;
    n=2;
    produs=1;
    if(p==0)
    {
        g<<1;
    }
    else
    {
        while(gasit==0)
        {
                produs=produs*n;
                t=produs;
                k=0;
                while(t%10==0)
                {
                    t=t/10;
                    k++;
                }
                if(k==p)
                {
                    gasit=1;
                    g<<n;
                }
                else
                {
                    n++;
                }
        }

    }



    return 0;
}