0

How Can we change this program to print the prime numbers in range(x).

the below program tells you the number is a prime or not. but how can we change this program to print the n prime numbers? i tried some methods but they are not working can anyone help me? https://code.sololearn.com/cWoOtM36qiAV/?ref=app

11th Aug 2020, 1:47 PM
Mr. 12
Mr. 12 - avatar
5 odpowiedzi
0
https://code.sololearn.com/cRj8TlSSWJ5L/?ref=app
11th Aug 2020, 1:57 PM
Namit Jain
Namit Jain - avatar
0
Namit Jain it is printing 4 also
11th Aug 2020, 1:58 PM
Mr. 12
Mr. 12 - avatar
0
Mr. 12 Now see the code! Sorry I didn't read the question correctly
11th Aug 2020, 2:02 PM
Namit Jain
Namit Jain - avatar
0
Namit Jain can you explain me your code?
11th Aug 2020, 2:04 PM
Mr. 12
Mr. 12 - avatar
0
Mr. 12 I have made 2 functions! One is to check whether the inputs is prime or not The other is to find the next prime number to the present prime number! And both of them are used in the for loop as told by you
11th Aug 2020, 2:17 PM
Namit Jain
Namit Jain - avatar