Cod sursa(job #2196419)

Utilizator MrJ33FGroza Cosmin MrJ33F Data 19 aprilie 2018 11:24:39
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.31 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int fact(int n);

int main()
{
    int n;
    fin>>n;
    fout<<fact(n);
    return 0;
}
int fact(int n)
{
    if(n>1)
    {
        return n*fact(n-1);
    }
    else
        return 1;
}