- 1
Please help me with prime number problem
Check the integer entered from the keyboard for a sign of simplicity. https://code.sololearn.com/cEll72AjLvnO/?ref=app
3 Answers
+ 3
Š®Š»ŠøŃ Š¢Š°ŃŠ°ŃŠ¾Š²Š° ,
line 19: condition in while loop is not correct
line 23: typo in var name
line 34: missing semicolon
line 36: typo
+ 2
Already answered your question in another post.
https://www.sololearn.com/discuss/3057402/?ref=app
+ 1
You can replace some of your code with this.......
while (i < n)
{
if (n % i == 0)
{
primeNumber = false;
break;
}
i++;
}
if (primeNumber)
{
Console.WriteLine("The number is prime");
}
else
{
Console.WriteLine("The number is not prime");
}
Console.ReadKey();