Write a python code which prints first 20 prime numbers using loop
Share
Write a python code which prints first 20 prime numbers using loop
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
It's not copied from the net I have typed it own
Code:
----------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
Output:
----------------------------------------------------------------------
all numbers between 0 and 20 are:
2
3
5
7
11
13
17
19
hope this helps you........................Ω
Answer:
Python code to print the first 20 prime numbers using loops.
Explanation:
Program:-
for Number in range (1, 73):
count = 0
for i in range(2, (Number//2 + 1)):
if(Number % i == 0):
count = count + 1
break
if (count == 0 and Number != 1):
print(" %d" %Number, end = ' ')
Output:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71