Pagini recente » Borderou de evaluare (job #1951500) | Cod sursa (job #1202802) | Monitorul de evaluare | Borderou de evaluare (job #1999955) | Cod sursa (job #212932)
Cod sursa(job #212932)
/*
* 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);
}