Created
May 29, 2015 22:17
-
-
Save samwx/183c2bc6db9a62678b6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment