0

How to code for print all prime numbers from 1to 10

13th Mar 2017, 4:10 AM
Bimali Chathunika
Bimali Chathunika - avatar
2 odpowiedzi
0
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] isPrime = True for i in range(0, 9): for k in range(2, 9): if(k == x[i]): continue else: if(x[i] % k == 0): isPrime = False if(isPrime == True): print(x[i]) else: isPrime = True;
13th Mar 2017, 4:36 AM
sniperisdemoman
sniperisdemoman - avatar