68. Python Program to find all the Prime numbers from 1 to 99.
How does this program work?
- This program is used to find all the Prime numbers from 1 to 99 using Python.
- Prime number means which is only divisible by 1 and that number itself, and cannot divisible by any other number.
- First store the number into variable, then we will find the remainder using loop.
- The counter will be increment if remainder zero, Once number can be divisible by some other number instead of 1 and that number itself, If its value less than three means its a primer number.
Here is the code
print("All Prime numbers from 1 to 99 are : \n")
for n in range(1,99):
if n > 1:
for i in range(2,n):
if (n % i) == 0:
break
else:
print(n, end=' ')