Print prime numbers in java

A prime number which can not be divided by any other number except 1 or by itself.

  • The only even prime number is 2. All other even numbers can be divided by 2.
  • Zero and 1 are not considered prime numbers.

e.g –

3 – prime number (3 can not be divided by any other number but can be divided by 1 or itself)

9 – not a prime number (can be divided by 3)



Let’s see the implementation

OutPut:

Prime numbers are –
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: