How To Get Prime Numbers In Java
Prime number is a number that is greater than 1 and divided by 1 or itself only. In other words, prime numbers can’t be divided by other numbers than itself or 1. For example 2, 3, 5, 7, 11, 13, 17…. are the prime numbers.
1. make 1 nested loop. the outer loop as a number that we will check and the inner loop for the numbers we will check
2. make 2 if statements on the inner loop
3. the first if statement will check the value of the inner loop is the same as the outer loop. if yes, then print the value from the outer loop
4. the second if statement will check the value of the outer loop when it is modulo with the value of the inner loop. if yes, then break the inner loop