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