Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- long factorial (long);
- int main ()
- {
- for (int i=1;i<10;i++)
- cout<<setw(2)<<i<<"!"<<factorial(i)<<endl;
- system ("pause");
- return 0;
- }
- long factorial (long n)
- {
- if (n<=1)
- return 1;
- else
- return n*factorial (n-1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement