*07 April 2019*

A prime number is a whole number greater than 1 whose only factors are 1 and itself. A factor is a whole numbers that can be divided evenly into another number. The first few prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. Numbers that have more than two factors are called composite numbers. The number 1 is neither prime nor composite.

```
class isPrimeNumber {
public static void main(String args[]) {
int temp = 0;
boolean flag = true;
int numberToBeChecked = 29;
temp = numberToBeChecked / 2;
if (numberToBeChecked == 0 || numberToBeChecked == 1) {
System.out.println(numberToBeChecked + " is not prime number");
} else {
for (int i = 2; i <= temp; i++) {
if (numberToBeChecked % i == 0) {
System.out.println(numberToBeChecked + " is not prime number");
flag = false;
break;
}
}
if (flag) {
System.out.println(numberToBeChecked + " is prime number");
}
}
}
}
```