• + 1 comment

    Hey, it's probably not working because in this code i is getting changed to start + 1 and then getting incremented again as part of the for loop.

    if(sum == d)
                    {
                        num++;
                        sum=0;
                        i=start+1;
                        start++;
                        end++;
                    }
                    else
                    {
                        sum=0;
                        i=start+1;
                        start++;
                        end++;
                    }
    

    Hope this helps.