- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Prime number is defined as a number not divisible by any other number except 1 and itself. Hence to ascertain that a number is prime, it should be checked for divisibility by all numbers between 1 and itself excluding both.

Following program lists all prime numbers between 1 to 100. Outer loop generates numbers in this range. Inner loop goes from 2 to each number in outer loop and successively checks divisibility by % operator. If it is not divisible by all numbers in inner range, it prints out that number

for i in range(101): for j in range(2,i-1): if i%j==0: break else: print (i)

- Related Questions & Answers
- Python program to print all Prime numbers in an Interval
- Python Program to Print Numbers in an Interval
- How to identify and print all the perfect numbers in some closed interval [ 2, n ] using Python?
- Print prime numbers with prime sum of digits in an array
- How to generate prime numbers using Python?
- Program to count odd numbers in an interval range using Python
- Print all prime numbers less than or equal to N in C++
- Program to find Prime Numbers Between given Interval in C++
- Sum of all prime numbers in an array - JavaScript
- Print all Semi-Prime Numbers less than or equal to N in C++
- Print prime numbers in a given range using C++ STL
- XOR of all Prime numbers in an Array in C++
- Product of all prime numbers in an Array in C++
- Program to print prime numbers in a given range using C++ STL
- Java program to print prime numbers below 100

Advertisements