samwx
5/29/2015 - 10:17 PM

multiplo.java

import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Samuel Martins
 */
public class Multiplo {

    public static void imprime(int[] vetor) {
        for (int i = 0; i < vetor.length; i++) {
            System.out.println(vetor[i] + " ");
        }
    }

    public static void multiplo(int[] vetor) {
        for (int i = 0; i < vetor.length; i++) {
            if (((vetor[i] % 2) != 0) && ((vetor[i] % 5) >= 1) && ((vetor[i] % 7) == 0)) {
                System.out.println(vetor[i] + " ");
            }
        }
    }

    public static void main(String args[]) {

        int MIN, MAX;
        int[] vetor;
        Scanner scanner = new Scanner(System.in);
        String[] integrantes = {"Samuel Martins", "Daniel Gregory", "Isabela Lima", "Frank Felipe", "Lilia Cardoso"};

        System.out.println("Digite o número min:");
        MIN = Integer.parseInt(scanner.nextLine());
        
        System.out.println("Digite o número max:");
        MAX = Integer.parseInt(scanner.nextLine());

        vetor = new int[(MAX - MIN) + 1];

        for (int i = 0; i < vetor.length; i++) //preenche vetor
        {
            if (i == 0) {
                vetor[i] = MIN;
            } else {
                vetor[i] = vetor[i - 1] + 1;
            }
        }
        
        for (String x : integrantes) {
            System.out.println(x);
        }

        System.out.println("\n");
        imprime(vetor);

        System.out.println("\n");
        multiplo(vetor);

        System.out.println();


    }

}