Code not working

#include
using namespace std;
int main() {
int arr[]={-2,3,1,6,8,0,-5,-7};
int n= sizeof(arr)/sizeof(arr[0]);
/* int su[n];
int sum=0;
for(int i=0;i<n;i++){
sum+=arr[i];
su[i]=sum;
}
for(int i=0;i<n;i++){
cout<<su[i]<<" ";
}
*/
int l=-1,r=-1;
int csum =0,fsum =0;
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
csum =0;
for(int k=i;k<=j;k++){
csum+=arr[k];

        }
        if(fsum<csum)
        fsum=csum;
         l=i;
         r=j;
   }

}
for(int u=l;u<=r;u++){
cout<<arr[u]<<" ";
}
cout<<endl<<fsum;

}

//this is same code as in the video but its output is not correct whats wrong with this code?

hi @anonymouslevone_98393e5729c3116b
refer this code -->

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.