Advertisement
Md_hosen_zisad

java matrix

Feb 26th, 2018
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. package max;
  2.  
  3. public class matrtix {
  4.  
  5.     public static void main(String[] args) {
  6.    
  7.         int a[][]={{1,1,0},{1,1,1},{2,2,2}};
  8.         int b[][]={{1,1,0},{1,1,1},{2,0,2}};
  9.         int i,j;
  10.         int c[][]=new int[3][3];
  11.     /*  for(i=0;i<3;i++)
  12.         {  for(j=0;j<3;j++)
  13.         {
  14.             c[i][j]=a[i][j]+b[i][j];
  15.         }
  16.         }*/
  17.         for(i=0;i<3;i++)
  18.         {for(j=0;j<3;j++)
  19.         {System.out.print((a[i][j]+b[i][j])+" ");
  20.         }
  21.        
  22.         System.out.println();}
  23.         }
  24.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement