Created
September 28, 2017 23:00
-
-
Save rhynl/97935307d303647328abbad369bbe109 to your computer and use it in GitHub Desktop.
Promedio de notas de estudiantes
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
| /* | |
| * To change this license header, choose License Headers in Project Properties. | |
| * To change this template file, choose Tools | Templates | |
| * and open the template in the editor. | |
| */ | |
| package javaapplication21; | |
| /** | |
| * | |
| * @author alumno | |
| */ | |
| public class JavaApplication21 { | |
| /** | |
| * @param args the command line arguments | |
| */ | |
| public static void main(String[] args) { | |
| // TODO code application logic here | |
| int[][] notasAlumnosdelCursoX = { | |
| {5,6,10,3}, | |
| {10,10,10,10}, | |
| {2,3,4,5,1} | |
| }; | |
| int mayor = 0; | |
| int pos = 0; | |
| double pro = 0; | |
| for (int i = 0; i < notasAlumnosdelCursoX.length; i++) { | |
| int suma = 0; | |
| for (int j = 0; j < notasAlumnosdelCursoX[i].length; j++) { | |
| suma += notasAlumnosdelCursoX[i][j]; | |
| } | |
| if (suma > mayor) { | |
| mayor = suma; | |
| pro = suma / notasAlumnosdelCursoX[i].length; | |
| pos = i; | |
| } | |
| } | |
| System.out.printf("el mayor promedio fue de %.2f, y la obtuvo el estudiante en la psoicion %d\n", pro, pos + 1); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment