Cod sursa(job #1639292)

Utilizator HazzLiuuMazareanu Dragos HazzLiuu Data 8 martie 2016 11:41:30
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.29 kb
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
ifstream in ("fact.in");
ofstream out ("fact.out");
int main()
{
    int a=1,n=1,p;
    in>>p;
    int c=pow(10,p);
    while (a%c!=0)
    {
        n++;
        a=a*n;
    }
    out<<n;
    return 0;
}