Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 ejercicios_matrices_i;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- /**
- *
- * @author Javi-PC
- */
- public class Ejercicio9 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws IOException {
- BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
- int filas, columnas;
- boolean mayor=false;
- System.out.println("Introduce el número de filas: ");
- filas = Integer.parseInt(br.readLine());
- System.out.println("Introduce el número de columnas: ");
- columnas = Integer.parseInt(br.readLine());
- int [][] matriz = new int [filas][columnas];
- for (int i=0;i<matriz.length;i++) {
- for (int j=0;j<matriz[i].length && mayor==false;j++) {
- if (matriz[i][j]>0) {
- mayor=true;
- }
- }
- }
- if (mayor==false) {
- System.out.println("Es nula.");
- } else {
- System.out.println("No es nula.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement