Finds the maximal sequence
Write a program, which finds the maximal sequence of consecutively placed increasing integers. Example: {3, 2, 3, 4, 2, 2, 4} ? {2, 3, 4}.
I write this program but when i enter n=5 and 2 5 6 7 6 isn't work :(
i'm beginner in c# so...
Sorry for my bad english i am Romanian
static void Main()
{
Console.Write("n=");
int n = int.Parse(Console.ReadLine());
int[] a = new int [n];
for (int i = 0; i < n; i++)
{
Console.Write("a[{0}]=", i);
a[i] = int.Parse(Console.ReadLine());
}
Console.WriteLine("maximal sequence");
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
if (a[i]<a[j])
{
Console.WriteLine(a[i]);
break;
}
}
}
}