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
rani m mk
NA
50
42.5k
Index out of range error
Jun 26 2012 6:00 AM
Hi all,
This is the code below which gives me the error mentioned in subject:
Here i want to extract the unique elements: output should be {1,3,5,9}
public static void Main()
{
int[] number={1,1,3,3,3,5,5,5,9,9,9,9};
int n = number.Length;
for (int i = 0; i < n; i++)
{
if (number[i] != number[i + 1])
{
Console.WriteLine(number[i]);
}
}
}
Thanks in advance
Reply
Answers (
10
)
What is Private Constructor in C#
Program to find angle between hours and mins hands of a clock