Cod sursa(job #1517535)

Utilizator dragos231456Neghina Dragos dragos231456 Data 4 noiembrie 2015 15:46:36
Problema Factorial Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    int n,p,m,t;
    ifstream f("fact.in");
    ofstream g("fact.out");
    f>>p;
    if(p!=0)
    {
        t=1;
        n=5;
        while(t<p)
        {
            n+=5;
            m=n;
            while(m%5==0)
            {
                t+=1;
                m/=5;
            }
        }

    }
    else n=1;
    g<<n;
}