Cod sursa(job #161341)

Utilizator lache92Hulub Ionut-Adrian lache92 Data 17 martie 2008 21:51:38
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include <fstream.h>

int main() {
    long int p, x;
    ifstream f("fact.in");
    ofstream fout("fact.out");
    f>>p;
    if (p == 0) {
       fout<<1;
       return 0;
       }
    if (p%5 == 0) {
            fout<<-1;
            return 0;
            }
    x = (p * 5);
    x -= x/5;
    fout<<x;
    return 0;
}