wap in Java to display all triple digit prime numbers.
Answers
Answered by
2
Program to display all triple digit prime numbers :-
public class PrimeNumbers
{
public static void main(String[] args)
{
for (int k = 100; k <= 999; i++)
{
boolean isPrime = true;
for (int m = 2; m < k; m++)
{
if (k % m== 0)
{
isPrime = false;
break;
}
}
if (isPrime)
{
System.out.println(k);
}
}
}
The output is:-
101
103
107
109
113
127
131
137
139
149
and so on.
Similar questions
French,
6 months ago
Accountancy,
6 months ago
Computer Science,
11 months ago
Biology,
11 months ago
Science,
1 year ago
Math,
1 year ago