my code

4) Implementar la función “mayor10_par”, que recibe una matriz, y es verdadera cuando:
Para todas las filas Fi,  ∃ x Fi tal que x > 10
Para todas las columnas Ci, ∃ y en Ci tal que y es par.
booleanmayor10_par(int[][] matriz){

Snippet options

Download: Download snippet as
Copy snippet: For this you need a free my code 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!

public class Ej4 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int matrix[][]={{2,2,2,16},{2,3,15,2}, {3,5,15,3}, {3,15,5,3}};

	static boolean mayor10_par(int [][] matriz){
	int fila = matriz.length;
	int col = matriz[0].length;

	boolean retfila = false;
	boolean retcol=false;
	boolean retF = true;
	boolean retC = true;
	for(int x=0;x<fila;x++){// recorre por fila
		for(int y=0;y<col;y++){
			retfila = retfila || (matriz[x][y]>10);	//true si encuentra algun>10 en la fila actual
		retF = retF && retfila; // lleva control que se cumpla para TODAS las filas	
		for(int y=0;y<col;y++){// recorre por columna
			for(int x =0;x<fila;x++){
				retcol = retcol || (matriz[x][y]%2==0);	//true si encuentra par en la columna actual
			retC = retC && retcol;// lleva control que se cumpla para TODAS las columnas		
			retcol = false;
		return retF && retC;	

Create a free my code account now.

my code 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!

Find out more and register now

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