# Ejercicio 5 by Gabyta Pereira

Implementar la función “mayorX_Y”, que recibe una matriz, y es verdadera cuando: todas las filas Xi son mayores que alguna columna Yi Una fila es mayor que una columna cuando la suma de sus números es mayor. Por ejemplo, sea la matriz m:
Colu 0 Colu 1 Colu 2 Fila 0 10 20 30 Fila 1 10 20 30 Fila 2 10 20 30
la fila 0, que suma 60, no es mayor que la columna2, que suma 90. Pero la fila 0, que suma 60, es mayor que la columna0, que suma 30. Como ocurre lo mismo para las filas 1 y 2, mayorX_Y es verdadera para m.

### Snippet options

Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

```package practica_Cero;

public class ej1 {

static int [][]mat = {{10,20,30},{10,20,30},{10,20,30}};
static int acumcol = 0;
static int acumfil = 0;

public static void main(String[] args) {
// TODO Auto-generated method stub

boolean ret = false;

System.out.println(mayorX_Y(mat, ret));
//		System.out.println(sumacol(mat,0));
//		System.out.println(sumafil(mat,0));
}
static boolean mayorX_Y (int mat[][], boolean ret){

for (int a=0; a<mat.length;a++){
ret = ret || (sumafil(mat, a)>sumacol(mat, a));

}
return ret;
}
static int sumacol (int mat[][], int f){
for (int i=0;i<mat[f].length;i++){
acumcol += mat[i][f];
}
return acumcol;
}
static int sumafil (int mat[][], int f){
for (int i=0;i<mat.length;i++){
acumfil += mat[f][i];
//				System.out.println(mat[f][i]);
}
return acumfil;
}
}```

### Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.