Ok i came up with this linear solution. Please check it whether it works with all data sets or what problems is it still suffering from
Code:
#include <stdio.h>
//To Find Largest Consecutive Sum Of Numbers in Array
int main(void)
{
int a[]={-1,-3,-5,-10,5,-2,3,-1,2,-1,10,-2};
int max_sum,temp_sum,i,n=12,t;
temp_sum=max_sum=a[0];
for(i=1;i<n;i++)
{
if(a[i]>0)
temp_sum+=a[i];
else
{
t=0;
while(a[i]<0 && i<n)
{
t+=a[i];
i++;
}
if(temp_sum+t>0)
{
temp_sum=temp_sum+t+a[i];
if(temp_sum>max_sum)
max_sum=temp_sum;
}
else if(i<n)
temp_sum=a[i];
}
}
if(temp_sum>max_sum)
max_sum=temp_sum;
printf("The Largest Sum Of Consecutive Numbers is %d",max_sum);
return 0;
}