#include<iostream>
using namespace std;
void Find_MaxSequnce(int A[],int N)
{
int tempNum=0;
int MaxNum=0;
for(int i=0;i<N; i++)
{
tempNum=A[i];
for(int j=i+1;j<N;j++)
{
tempNum+=A[j];
if(tempNum>MaxNum)
{
MaxNum=tempNum;
}
}
tempNum=0;
}
if(MaxNum<0)
cout<<"0"<<endl;
cout<<MaxNum;
}
{
int tempNum=0;
int MaxNum=0;
for(int i=0;i<N; i++)
{
tempNum=A[i];
for(int j=i+1;j<N;j++)
{
tempNum+=A[j];
if(tempNum>MaxNum)
{
MaxNum=tempNum;
}
}
tempNum=0;
}
if(MaxNum<0)
cout<<"0"<<endl;
cout<<MaxNum;
}
int main()
{
int n=6;
int a[]={-2,-11,-4,-13,-5,562};
Find_MaxSequnce(a,n);
return 0;
}
{
int n=6;
int a[]={-2,-11,-4,-13,-5,562};
Find_MaxSequnce(a,n);
return 0;
}