Hello,

i wrote a program .Please analyse it and if any bug or any optimisation required then please suggest

Code:`#include <stdio.h>`

//To Find Largest Consecutive Sum Of Numbers in Array

int main(void)

{

int a[]={-1,-3,-5,-10,5,10,-20};

int p,q,i,n=8;

p=q=a[0];

for(i=1;i<n;i++)

{

if(a[i]>0 && p>0)

p+=a[i];

else

{

if(p>q)

q=p;

p=a[i];

}

}

if(p>q)

q=p;

printf("The Largest Sum Of Consecutive Numbers is %d",q);

return 0;

}