Cod sursa(job #212932)
| Utilizator | Data | 7 octombrie 2008 21:02:57 | |
|---|---|---|---|
| Problema | Factorial | Scor | 5 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
/*
* File: main.cpp
* Author: Catilin
*
* Created on October 7, 2008, 1:20 PM
*/
#include <stdlib.h>
#include <fstream.h>
#include <iostream.h>
ifstream f("fact.in");
ofstream g("fact.out");
//ofstream z("fact.test");
int P;
int fact(int a)
{ int c;
if (P<5 && P!=0)
c=5*P;
else
if (P>=5)
c=5*(P-1);
else
c=-1;
return c;
}
int main(int argc, char** argv) {
f>>P;
g<<fact(P);
f.close();
g.close();
//z.close();
return (0);
}
