Cod sursa(job #1889500)

Utilizator octavian.a.niculescuOctavian Niculescu octavian.a.niculescu Data 22 februarie 2017 19:05:44
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    int p, n, x=0, ok=0;
    ifstream f("fact.in");
    ofstream g("fact.out");
    f>>p;
    if(p==0)
    {
        g<<"1";
    }
    else
    {
    do {
    x=x+5;
    n=x;
    ok++;
    if(ok%5==0)
    {
        ok++;
    }
    }while(ok<p);
    }
    f.close();
    g<<n<<'\n';
    g.close();
}