I tried this way but it is not covering all sums

#include<bits/stdc++.h>
using namespace std;
void subarray(int arr[],int n){

int currentsum=0;int maximumsum=0;

for(int i =0;i<n;i++){
for(int j=i;j<n;j++){
currentsum=0;
for(int k=i;k<=j;k++)currentsum+=arr[k];}cout<<currentsum<<endl;
}
}
int main(){
int arr[]={-4,1,3,-2,6,2,-8,-9,4};
subarray(arr,9);
}

Hello @argus could you please share your code by saving it on ide.codingblocks.com .

Hello @argus i have checked your approach and your approach is not the optmised one.
please see for reference kadanes video in your course then if you have any doubt you can ask here:
Happy Learning!!