All prime numbers

Level MEDIUM

Given an integer N, print all the prime numbers that lie in the range 2 to N (both inclusive).

Input Format :
Integer N
Output Format :
Prime numbers in different lines
Constraints :
1 <= N <= 100
Sample Input 1:
9
Sample Output 1:
2
3
5
7
Sample Input 2:
20
Sample Output 2:
2
3
5
7
11
13
17
19

Comments

Popular posts from this blog

MySQL Multi Source Master Slave Replication using GTID

Setting Up PostgreSQL Logical Replication with Docker Compose

Regex 101: An Introduction to Regular Expressions for Developers