In this program, we will print prime numbers from 1 to 100 in java.
A prime number is a number which has only two divisors 1 and itself. To check if the number is prime or not, we need to see if it has any other factors other than 1 or itself. If it has, then number is not prime else number is prime.
Iterate from 1 to 100.
In each iteration, check is number is prime or not.