Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PrimzahlenTest {
- // Hier wird das Programm gestartet
- public static void main(String[] args){
- // hier werden alle Primzahlen bis 101 geholt
- int max = 101;
- int[] diePrimzahlen = primzahlen(max);
- // hier drucken wir die Primzahlen in die Konsole
- for(int i=0;i<diePrimzahlen.length;i++){
- System.out.println(diePrimzahlen[i]);
- }
- }
- static int[] primzahlen(int max) {
- boolean [] sieb = new boolean [max+1];
- int anzahl=0;
- sieb[0]=sieb[1]=false;
- for (int i=2; i//...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement