Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package teste;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- int[] vetor = new int[3];
- Scanner sc = new Scanner(System.in);
- for(int i = 0; i < vetor.length; i++) {
- vetor[i] = Integer.parseInt(sc.nextLine());
- }
- for(int j = 0; j < vetor.length; j++) {
- int count = 0;
- for(int i = 1; i <= vetor[j]; i++) {
- if(vetor[j] % i == 0) {
- count++;
- }
- }
- if(count == 2) {
- System.out.println(vetor[j] + " - " + j);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment