puppy and sum problem

how to solve puppy and sum problem.i written write code many times but it is shown wrong can anyone help me out…

int solve(int d, int n){

    if(d == 1){
        return n*(n+1)/2;
    }
    return solve(d-1, n*(n+1)/2);
}

A recursive function that returns the value of sum(d,n).
Basically each step you are reducing d by one and increasing the n to the sum of each element from 1 to n.