Cod sursa(job #2426969)
Utilizator | Data | 30 mai 2019 10:48:57 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
int n,i,p,c,nr=0;
in>>p;
if(p==0)
n=1;
else if(p%5==1)
n=5*p-5;
else if(p%5==0)
n=1;
else
n=5*p;
out<<n;
in.close();
out.close();
return 0;
}