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