

write a python program to print prime numbers in a given range using a for loop Now we understand what is prime number and how to implement a prime number program in python so now it’s time to do it practically. Step-5: if i = j then print i ( Because i is your prime number) Step-4: step-3 implies that if a number i is not divisible by j then the program never enters in if-block, this means at the end of the second for-loop i = j Step-3: check if i%j = 0 then break a loop (Because a number is not prime) Step-2: inside the first loop create another for loop in the range 2 to 100 –> for j in range(2,101)

Step-1: iterate a for loop in range 2 to100 –> for i in range(2,101) Algorithm to Print Prime Numbers from 1 to 100 It does not store any personal data.9 Write a python program to create a list of prime numbers from 1 to N What is a prime number?Ī natural number that is only divisible by 1 and itself is called a prime number.įor example: 2,3,5,7,11,13,17,19…. The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. The cookie is used to store the user consent for the cookies in the category "Performance".


This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. The cookies is used to store the user consent for the cookies in the category "Necessary". The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". The cookie is used to store the user consent for the cookies in the category "Analytics". These cookies ensure basic functionalities and security features of the website, anonymously. Necessary cookies are absolutely essential for the website to function properly.
