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