Cod sursa(job #2458500)
Utilizator | Data | 20 septembrie 2019 19:19:38 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.25 kb |
#include<fstream>
constexpr int factorial(int n) {
return n <= 1 ? 1 : (n * factorial(n - 1));
}
auto main() ->int {
int number;
std::ifstream input("fact.txt");
input >> number;
std::ofstream output("fact.out");
output << factorial(10);
}