Given an integer N, print all the prime numbers that lie in the range 2 to N (both inclusive).
Print the prime numbers in different lines.
The only line of input contains a single integer N.
Output format :
Print all Prime numbers in a separate line.
1 <= N <= 100
9
2
3
5
7
20
2
3
5
7
11
13
17
19
In the outer loop, we are iterating i from 2 to n, and at the beginning of the loop set, the value of the flag to True after that in the nested loop iterate j from 2 to i check if i is divisible by j it means i has a factor and it is not a prime. Finally, check if the flag's value is True, then it is prime else, not prime.
If it is prime print i, else do nothing.