Advertisement
keviinrm7

solicita un numero y sumarlos

May 31st, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. Scanner teclado= new Scanner(System.in);
  2. int num=0;
  3. double notas,suma=0;
  4. System.out.print("Cuantos numeros desea ingresar: ");
  5. num=teclado.nextInt();
  6.  
  7. for (int i=0; i<num;i++)
  8. {
  9. System.out.println("nota");
  10. notas=teclado.nextDouble();
  11. suma=suma+notas;
  12. }
  13. double promedio=suma/num;
  14. System.out.println("Promedio: "+promedio);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement