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