#include <iostream>
using namespace std;
long fact(int N) {
if (N < 0) return 0;
if (N == 0) return 1;
else
return N * fact(N - 1);
}
int main() {
int n;
cin >> n;
cout << fact(n) << endl;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
long fact(int N) {
if (N < 0) return 0;
if (N == 0) return 1;
else
return N * fact(N - 1);
}
int main() {
int n;
cin >> n;
cout << fact(n) << endl;
return 0;
}