Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by anonymous12345 ( 6 years ago )
#include <stdio.h>

void main()
{

int n;
printf("Enter the length of array: ");
scanf("%d", &n);

int arr[n];
int i=0;

for (i = 0 ; i<n ; i++)
{
    scanf("%d",&arr[i]);
}

int t=0;
int l=0;
int count = 0;
int flag=0;

for(i=0;i<n-2;i++)
{
    if(arr[i]<arr[i+1])
    {
        if(flag==0)
        {
            count++;
            flag = 1;
        }
        t++;
        if(t>1)
        {
            l=t;
        }
        if(t==1)
        {
            l = l+t;
        }
    }
    else
    {
        t=0;
        flag=0;
    }
}
printf("Largest length of array is: %d \n", l);
printf("Number of sequences are: %d \n", count);
}

 

Revise this Paste

Your Name: Code Language: