-
-
Save mariiaKolokolova/c0b2846705cf8f505f26d4f73ab2ceb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package maricka.kolokolova; | |
public class Main { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
int st = 1; | |
int end = 100; | |
int ch = 0; | |
System.out.println("Prime numbers: "); | |
for (int i = st; i <= end; i++) { | |
ch = 0; | |
if (i == 1) { | |
ch = 1; | |
continue; | |
} | |
for (int j = st; j <= end; j++) { | |
if (j != 1 && j != i) { | |
if (i % j == 0) { | |
ch = ch + 1; | |
break; | |
} | |
} | |
} | |
if (ch == 0) { | |
System.out.print(i + " "); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment