You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
412 B

2 years ago
  1. package LernProgramm;
  2. import java.util.Random;
  3. import java.util.Scanner;
  4. public class FunktionenAusgelagert {
  5. public static void PrimBis100() {
  6. for (int i = 2; i <= 100; i++) {
  7. boolean istPrimZahl = true;
  8. for (int j = 2; j < i; j++) {
  9. if (i % j == 0) {
  10. istPrimZahl = false;
  11. break;
  12. }
  13. }
  14. if (istPrimZahl) {
  15. System.out.print(i + " ");
  16. }
  17. }
  18. }
  19. }