Cod sursa(job #2062298)

Utilizator Andrei_RAndrei Roceanu Andrei_R Data 10 noiembrie 2017 10:48:13
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.31 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream f("fact.in");
ofstream g("fact.out");

int main()
{
    int p, i, x, cx, k;
    f >> p;
    x = p * 5;
    while ( p >= 6 ) {
        x = x - 5;
        p = p - 6;
    }
    if ( x == 0 )
        g << "1";
    else
        g << x;
    return 0;
}