```
int sequence(int a[],int n,int i,int s,int b[],int *sum,int j)
{
if(s==n)
return 0;
int add=0,k;
for(k=i;k<=n-s+j;k++)
{
//printf("%d+",a[k]);=add+a[k];
}
if(add > *sum)
{
*sum = add;
b[0] = i;
b[1] = n-s+j;
}
s++;
for(k=0,j=0;k<s;k++,i++,j++)
sequence(a,n,i,s,b,sum,j);
}
int main()
{
int a[20],b[2];
int i,sum,n;
sum=0;
printf("Enter theno of element in sequence => ");
scanf("%d",&n);
printf("\nEnter the sequence element => ");
for(i=0;i<n;i++)
{
printf("\nEnter the element %d = ",i+1);
scanf("%d",&a[i]);
}
sequence(a,n,0,1,b,&sum,0);
printf("\n\nSum of largst sequence => %d\nindex %d to %d\n\n",sum,b[0],b[1]);
return 0;
}
```