Created
September 18, 2016 16:02
-
-
Save victorximenis/27451faa9c6fd64a954e640305cfadb8 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; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int[] vetor = new int[10]; | |
for (int i = 0; i < vetor.length; i++) { | |
System.out.println("Digite um numero: "); | |
int numero = sc.nextInt(); | |
vetor[i] = (numero < 0) ? 0 : numero; | |
} | |
for (int numero : vetor) { | |
System.out.println(numero); | |
} | |
sc.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment