- 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

8th Jul 2022, 3:11 PM
Юлия Тарасова
3 odpowiedzi
+ 3
Юлия Тарасова , line 19: condition in while loop is not correct line 23: typo in var name line 34: missing semicolon line 36: typo
8th Jul 2022, 3:41 PM
Lothar
Lothar - avatar
+ 2
Already answered your question in another post. https://www.sololearn.com/discuss/3057402/?ref=app
8th Jul 2022, 4:24 PM
SomeAwesome
SomeAwesome - avatar
+ 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();
8th Jul 2022, 3:38 PM
Jan
Jan - avatar