Computer Science, asked by user975, 11 months ago

wap in Java to display all triple digit prime numbers.

Answers

Answered by Geekydude121
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