Write in C language.

1 answer below »
Write in C language.
Answered Same DayMay 27, 2021

Answer To: Write in C language.

Sanchi answered on May 27 2021
133 Votes
#include
#include
int main()
{
for(int l=0;l<15;l++)
{
int arr[15];
int
strt_idx[15];
int segmnt_sum[15];
//random numbers
for(int i=0;i<15;i++)
{
arr[i]=rand()%400-200;
}
int sum=0;

//start index
for(int i=0;i<15;i++)
{
if(sum+arr[i]<=0)
{
strt_idx[i]=-1;
sum=0;
}
else if (i!=0&&strt_idx[i-1]!=-1)
{
strt_idx[i]=strt_idx[i-1];
sum+=arr[i];
}
else
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here