document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public class GeneratePrimeNumbersExample
  2. {
  3.         public static void main(String[] args)
  4.             {
  5.                 int limit = 100;
  6.                 System.out.println("Prime numbers between 1 and " + limit);
  7.                 for(int i=2; i < 100; i++)
  8.                     {
  9.                         boolean isPrime = true;
  10.                         for(int j=2; j < i ; j++)
  11.                         {
  12.                                 if(i % j == 0)
  13.                                 {
  14.                                         isPrime = false;
  15.                                         break;
  16.                                 }
  17.                         }
  18.                         // print the number
  19.                         if(isPrime)
  20.                                 System.out.print(i + " ");
  21.                 }
  22.         }
  23. }
');