//Usually Kadene's algorithm is not considered for negative numbers. int ms,cs; ms=cs=a[0]; for(int i=1;i