Created
November 22, 2012 13:46
-
-
Save marioplumbarius/4131250 to your computer and use it in GitHub Desktop.
Programa em Java que lê X entradas de dados e as imprime na ordem inversa.
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
/* | |
* Construir um programa em java que faça a leitura | |
* de 10 números e os imprima na ordem inversa que foram lidos | |
*/ | |
package vetores; | |
import java.util.Scanner; | |
public class Exercicio01 { | |
public static void main(String[] args){ | |
Scanner ent = new Scanner(System.in); | |
// declaração de vetor | |
int[] vetor = new int[10]; | |
// entrada de dados | |
for(int i = 0; i < vetor.length; i++){ | |
System.out.println("Digite um número"); | |
vetor[i] = ent.nextInt(); | |
} | |
// saída de dados | |
for(int i = vetor.length-1; i >= 0; i--){ | |
System.out.println(vetor[i]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Realmente apreciei a tua lógica. Bem óbvia.