0

PLS FIND AN ALGORITHM THAT DIFFERENTIATES BETWEEN PRIME AND COMPOSITE NUMBERS. Using Python... Tnx In Advance...

31st Jul 2019, 5:52 PM
Abis Tech
Abis Tech - avatar
2 Answers
+ 1
Something like this: n=int(input("Enter a number:\n")) for each in range(2,n+1): if all(each%i!=0 for i in range(2,each)): print(each, "is prime")
31st Jul 2019, 8:47 PM
Steven M
Steven M - avatar
0
Tnx
31st Jul 2019, 9:23 PM
Abis Tech
Abis Tech - avatar