Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.36 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package ejercicios_matrices_i;
  7.  
  8. import java.io.BufferedReader;
  9. import java.io.IOException;
  10. import java.io.InputStreamReader;
  11.  
  12. /**
  13.  *
  14.  * @author Javi-PC
  15.  */
  16. public class Ejercicio9 {
  17.  
  18.     /**
  19.      * @param args the command line arguments
  20.      */
  21.     public static void main(String[] args) throws IOException {
  22.         BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
  23.        
  24.         int filas, columnas;
  25.         boolean mayor=false;
  26.        
  27.         System.out.println("Introduce el número de filas: ");
  28.         filas = Integer.parseInt(br.readLine());
  29.         System.out.println("Introduce el número de columnas: ");
  30.         columnas = Integer.parseInt(br.readLine());
  31.        
  32.         int [][] matriz = new int [filas][columnas];
  33.        
  34.         for (int i=0;i<matriz.length;i++) {
  35.             for (int j=0;j<matriz[i].length && mayor==false;j++) {
  36.                 if (matriz[i][j]>0) {
  37.                     mayor=true;
  38.                 }
  39.             }
  40.         }
  41.        
  42.         if (mayor==false) {
  43.             System.out.println("Es nula.");
  44.         } else {
  45.             System.out.println("No es nula.");
  46.         }
  47.     }  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement