Can someone check my code to see where I am wrong? I am trying to make prime numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone check my code to see where I am wrong? I am trying to make prime numbers

prime number java code

12th Dec 2017, 10:10 AM
Yonathan Adugna Kebede
Yonathan Adugna Kebede - avatar
2 Answers
+ 1
I kind of modified your code to show how it works and where error is... https://code.sololearn.com/c1F257OlTUnl/?ref=app Lets take a look at i=3 it is a prime number but it will not go to the 2nd for loop, so k++ will not be performed it also will not go through the if since k=2 and i/2 =1.5
12th Dec 2017, 11:02 AM
Dima Makieiev
Dima Makieiev - avatar
7th Jan 2018, 10:54 PM
I. Stark
I. Stark - avatar