Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- long int f(int n)
- {
- return (n > 1 ? n*f(n-1) : 1);
- }
- long int fCount(int n)
- {
- long int count = 0;
- for(int i = 1; i <= n; i++)
- {
- count += f(i);
- }
- return count;
- }
- int main()
- {
- int N;
- cout<< "Enter Your Number: ";
- cin>>N;
- cout << fCount(N);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement