daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Oct 21st, 2018 68 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. public class HelloWorld{
  2.  
  3.      public static void main(String []args){
  4.         System.out.print("The prime numbers between 1 and 100:");
  5.         int limit = 100;
  6.         int count = 0;
  7.         for(int i = 1; i <= limit; i++){
  8.             boolean isPrime = true;
  9.             for(int j = 2; j <= i/2; j++){
  10.                 if(i % j == 0){
  11.                     isPrime = false;
  12.                     break;
  13.                 }
  14.             }
  15.             if (isPrime){
  16.                 System.out.print(i + " ");
  17.                 count = count + 1;
  18.             }
  19.             if (count == 5){
  20.                 System.out.print("\n");
  21.                 count = 0;
  22.             }
  23.            
  24.         }
  25.      }
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top