Cod sursa(job #2197724)
Utilizator | Data | 22 aprilie 2018 19:23:24 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.3 kb |
#include<iostream>
#include<fstream>
using namespace std;
int main() {
int n;
unsigned long long f = 1;
ifstream x;
x.open("fact.in");
x>>n;
ofstream g;
g.open("fact.out");
if(n == 0) {
g<<"1";
return 0;
}
for(int i = 1; i <= n; i++) {
f = f * i;
}
g<<f;
return 0;
}