Advertisement
cesarnascimento

matriz?

May 22nd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class codigo {
  5.  
  6.  
  7.     public static void main(String[] args) {
  8.         int matriz[][]=new int [6][6];
  9.         int array []=new int[matriz.length];
  10.         Scanner sc = new Scanner(System.in);
  11.        
  12.         for  (int i = 0;i < matriz.length;i++){
  13.             for(int j =0;j <matriz[i].length; j++){
  14.                 System.out.println("Digite os nΓΊmeros: ");
  15.                 matriz[i][j]=sc.nextInt();
  16.                
  17.             }
  18.         }
  19.         for(int i = 0; i<matriz.length;i++){
  20.             for(int j = 0; j<matriz[i].length;j++){
  21.                 if(i % 2 == 0){
  22.                     array[i] = matriz[i][j];
  23.                     System.out.println(array[i]);
  24.                 }
  25.             }
  26.         }
  27.     sc.close();
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement