Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int factorial(int x) {
- if (x==0) return 1;
- else return x*factorial(x-1);
- }
- int main() {
- int n;
- while (cin>>n) cout<<factorial(n)<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment