Finding the prime number is one of the most basic problems of mathematics . In this post we are going to see how can we implement this code in java .
First of all what is Prime Number - A number is called prime number when it is divisible by two numbers: either 1 or itself. So, if there is any number which is is divisible by any other number, that number is not called a prime number.
Input : number = 10 ;
Output : No
Explanation : 10 is divisible by 1,2,5,10 . So it is not a prime number.
Input : number = 7 ;
Output : Yes
Explanation : 7 is divisible by only 1,7. No other number can divide it . So it is a prime number.
Output : Not a prime number