```
#include <stdio.h>
int main(void)
{
int i,j,x,y,max=0,tem=0,v1,v2, arr[] = {15, 15, 120, 150, -250, 40, 50, 35, -20, -50},z,k;
int n=10; // length of array
k=n;
for(i=0;i<n;i++)
{
x=0;
y=k;
while(y<=n)
{
tem=0;
for(z=x;z<y;z++)
tem+=arr[z];
if(tem>max)
{
max=tem;
v1=x;
v2=y;
}
x++;
y++;
}
k--;
}
for(;v1<v2;v1++)
printf("%d\n" ,arr[v1]);
return 0;
}
```