Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class RefactoringPrimeChecker {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- for (int i = 2; i <= n; i++) {
- boolean check = true;
- for (int j = 2; j <= Math.sqrt(i); j ++) {
- if (i % j == 0) {
- check = false;
- // break;
- }
- }
- System.out.printf("%d -> %b%n", i, check);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment