Cod sursa(job #1645943)

Utilizator paulstepanovStepanov Paul paulstepanov Data 10 martie 2016 14:25:22
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.31 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");

int factorial(int x)
{
    if(x==0) return 1;
    if(x==1) return 5;
    if(x==2) return 10;
    if(x>2) return 5*(x-1);
}
int main()
{
    int n;
    fin>>n;
    fout<<factorial(n);
}