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