fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // usar locale US para que o separador decimal seja o ponto
  13. Scanner sc = new Scanner(System.in).useLocale(Locale.US);
  14. System.out.println("Entre com o numero de notas: ");
  15. int quantidadeNotas = sc.nextInt();
  16.  
  17. double notas[] = new double[quantidadeNotas];
  18.  
  19. for (int i = 0; i < quantidadeNotas; i++){
  20. System.out.println ("Entre com a nota [" + (i + 1) + "]: ");
  21. notas[i] = sc.nextDouble();
  22. }
  23.  
  24. for (double nota: notas){
  25. System.out.println(nota);
  26. }
  27. }
  28. }
Success #stdin #stdout 0.15s 53768KB
stdin
3
1.4
4.5
8.7
stdout
Entre com o numero de notas: 
Entre com a nota [1]: 
Entre com a nota [2]: 
Entre com a nota [3]: 
1.4
4.5
8.7