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
Quang Dinh Luong
NA
76
18.6k
Cannot apply indexing with [] to an expression of type "int"
Oct 9 2015 10:17 PM
int n = int.Parse(textBox2.Text);
int Primes
[n + 1]
;
for (int i = 0; i <=
Sqrt
(n); i++)
Primes[i]
= 1;
Primes[0]
= 0;
Primes[1]
= 0;
for(int i = 2; i <= n; i++)
{
if(
Primes[i]
== 1)
{
for (int j = 2; i * j <= n; j++)
Primes[i * j]
= 0;
}
}
The error is the subject!
I marked error code as red!
Is anyone know why?
Thanks
Reply
Answers (
5
)
Inserting and selecing record using userid not working
localhost error