[CLOSED] [C#] Help me debug my code! (Sieve of Eratosthenes challenge). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

[CLOSED] [C#] Help me debug my code! (Sieve of Eratosthenes challenge).

So I tried to solve the Sieve of Eratosthenes problem and came up with my solution on C#. But I'm getting some errors in my code can someone help me debug it, I can't see what I did wrong? https://www.sololearn.com/learn/969/?ref=app https://code.sololearn.com/cVNxKTQ3Otlj/?ref=app

12th Mar 2018, 2:34 PM
Rusty.Metal
1 Answer
+ 2
You can't use "foreach" and num.remove() together. Foreach expects the list to stay the same size. You are alowed to alter element but you are not alowed to remove elements from the list. Use a for-loop. https://www.dotnetperls.com/foreach
12th Mar 2018, 3:37 PM
sneeze
sneeze - avatar