Can someone help me code a code which prints prime no. Infinitely. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone help me code a code which prints prime no. Infinitely.

I tried but couldn't figure out how make a loop which will % the number by all the numbers smaller than it except 0,1 and the number itself. https://code.sololearn.com/c4OZfa6kF3pX/?ref=app

10th Apr 2019, 4:13 PM
Kenee Patel
Kenee Patel - avatar
7 Answers
+ 4
Kenee Patel you may post your code here, so we can figure out what happened wrong.
10th Apr 2019, 4:16 PM
Seniru
Seniru - avatar
+ 3
Kenee Patel actually making infinite is useless especially in sololearn's IDE - which will result in a time limit exceed error. You can try to produce primes upto a certain value if you like
10th Apr 2019, 4:44 PM
Seniru
Seniru - avatar
+ 2
If u wont laugh
10th Apr 2019, 4:16 PM
Kenee Patel
Kenee Patel - avatar
+ 1
10th Apr 2019, 4:22 PM
Kenee Patel
Kenee Patel - avatar
+ 1
Okay i m gonna try that
10th Apr 2019, 4:50 PM
Kenee Patel
Kenee Patel - avatar
+ 1
See this Seniru Pasan, i m almost done, can u check whats wrong, i m not a pro. https://code.sololearn.com/cQsQP7weuiyg/?ref=app
10th Apr 2019, 5:01 PM
Kenee Patel
Kenee Patel - avatar
0
https://code.sololearn.com/cQsQP7weuiyg/?ref=app Its working but weirdly
10th Apr 2019, 5:06 PM
Kenee Patel
Kenee Patel - avatar