Created
June 7, 2013 21:29
-
-
Save gmfc/5732546 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
| import java.util.*; | |
| class matriz{ | |
| public static void main(String[] args){ | |
| Scanner s = new Scanner(System.in);//Scanner inicializado em s | |
| int[] vetor;//Vetor principal | |
| String[] entrada;//Vetor de entrada | |
| entrada = s.nextLine().split(" ");//Reparte a entrada e coloca no vetor de entrada separando por espaços. | |
| vetor = new int[entrada.length];//Inicializa o vetor principal com o tamanho do vetor deentrada. | |
| for(int i=0;i<entrada.length;i++){//Transcreve o vetor de entrada no vetor principal | |
| vetor[i]=Integer.parseInt(entrada[i]);//Converte os valores para Int. | |
| } | |
| mostraVetor(vetor); | |
| } | |
| public static void mostraVetor(int v[]){//Método que imprime o vetor | |
| for(int i=0;i<v.length;i++){ | |
| System.out.println(v[i]); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment