Created
June 5, 2025 23:32
-
-
Save Moura07s/5924403a8495ed7fa693e45a8303279b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package Vetores; | |
import java.util.Scanner; | |
import java.util.ArrayList; | |
public class VETOR { | |
public static void maiorValor(int[]lista) { | |
int maior = lista[0]; | |
for (int i = 0; i < lista.length; i++) { | |
if (maior < lista[i]) { | |
maior = lista[i]; | |
} | |
} | |
System.out.println("Maior valor: " + maior); | |
} | |
public static void imprime(int[] numeros) { | |
for(int i=0;i<numeros.length;i++){ | |
System.out.println(numeros[i]); | |
} | |
} | |
public static void main(String[] args) { | |
Scanner s = new Scanner(System.in); | |
int[] lista = new int[5]; | |
for (int i = 0; i < lista.length; i++) { | |
System.out.println("Digite um valor: "); | |
lista[i] = s.nextInt(); | |
} | |
imprime(lista); | |
maiorValor(lista); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment