Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1. public class Aufgabe1 {
  2.  
  3.     public boolean isPrim(int zahl) {
  4.         for (int j = 2; j < zahl; j++) {
  5.             if (zahl % j == 0) {
  6.                 return false;
  7.             }
  8.         }
  9.         return true;
  10.     }
  11.  
  12.     public static void main(String[] argv) {
  13.         Aufgabe1 M = new Aufgabe1();
  14.         for (int n = 10; n <= 10000; n++) {
  15.             if (M.isPrim(n) == true) {
  16.                 System.out.println(n);
  17.             }
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement