TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ursaciuc Adrian
NA
1
3.1k
Finds the maximal sequence
Jan 28 2015 1:02 PM
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;
}
}
}
}
Reply
Answers (
1
)
Problem with RadioButtonList
Binary Search ADT