Interview Solution

For a long time it puzzled me how something so expensive, so leading edge, could be so useless. And then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. Bill Bryson

is Prime

Language Java | Level Intermediate | Category Interview Problems | July 24, 2015 4:52 pm

Comments


Interview Problem

Prime Number is a number which can be divided evenly only by 1, or itself.
The prime number has only two divisors, 1 and same number. Prime numbers mainly used in public key cryptography.
Example:-
13 We can divide only by 1 or 13. 13 doesn't have any other divisor. So, it is a prime number.
12 We can divide 1, 2,3,4,6. 12 has many divisors. So, it is not a prime number.


Output

   					 
Print the first 20 primenumbers :1 2 3 5 7 11 13 17 19

				    

Comments



Please login to add comments.