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