fork 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.  
  13. Scanner sc = new Scanner(System.in);
  14. boolean continuamos = true;
  15. int auxNota = 0;
  16. int i = 0;
  17. String respuesta;
  18.  
  19. do {
  20.  
  21. System.out.println("Ingrese la nota");
  22.  
  23. int nota = sc.nextInt();
  24.  
  25. auxNota += nota;
  26.  
  27. i++;
  28.  
  29. System.out.println("Continuamos?");
  30.  
  31. sc.nextLine();
  32. respuesta = sc.nextLine();
  33.  
  34. if (respuesta.equals("n")) continuamos = false;
  35.  
  36. }while(continuamos);
  37.  
  38. System.out.println("El Promedio de notas es : "+(auxNota/i));
  39.  
  40.  
  41. }
  42. }
Success #stdin #stdout 0.08s 4386816KB
stdin
1
n
stdout
Ingrese la nota
Continuamos?
El Promedio de notas es : 1