Cod sursa(job #2437801)

Utilizator Sebastian32Olaru Sebastian Sebastian32 Data 10 iulie 2019 13:26:24
Problema Factorial Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.28 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int fact(int nr)
{
    if(nr==1)
        return 1;
    else return nr*fact(nr-1);
}
int main()
{
    int nr;
    in>>nr;
    out<<fact(nr);
    return 0;
}