Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String [] args){
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- int contador = 0;
- for(int i = 1; i <= n; i++){
- int v = sc.nextInt();
- for(int j = 1; j <= v; j++){
- if(v % j == 0){
- contador++;
- }
- }
- if(contador == 2){
- System.out.println("PRIME");
- }
- else{
- System.out.println("NOT PRIME");
- }
- }
- }
- }
- import java.util.Scanner;
- public class Main {
- public static void main(String [] args){
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- for (int i = 1; i <= n; i++) {
- int v = sc.nextInt();
- int contador = 0;
- for (int j = 1; j <= v; j++) {
- if (v % j == 0){
- contador++;
- if (contador == 3) {
- break;
- }
- }
- }
- if (contador == 2) {
- System.out.println("PRIME");
- } else {
- System.out.println("NOT PRIME");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement