GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Java/Matrix.java at main · Gokulkrishnajayan/Java Expand file tree/ Copy pathMatrix.javaMore file actions 49 lines (48 loc) · 1.23 KB / Copy pathMatrix.javaFile metadata and controls49 lines (48 loc) · 1.23 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 import java.util.Scanner; class Matrix{ public static void main(String args[]){ int a[][]=new int[20][20]; int b[][]=new int[20][20]; int c[][]=new int[20][20]; int i,j,n,m; System.out.println("enter the size of first array:"); Scanner read= new Scanner(System.in); n=read.nextInt(); System.out.println("Enter the elements:"); for(i=0;i<n;i++){ for(j=0;j<n;j++){ a[i][j]=read.nextInt(); } } System.out.println("enter the size of second array:"); m=read.nextInt(); System.out.println("Enter the elements:"); for(i=0;i<m;i++){ for(j=0;j<m;j++){ b[i][j]=read.nextInt(); } } System.out.println("the first array is:"); for(i=0;i<n;i++){ for(j=0;j<n;j++){ System.out.print(a[i][j]+"\t"); } System.out.print("\n"); } System.out.println("the second array is:"); for(i=0;i<n;i++){ for(j=0;j<n;j++){ System.out.print(b[i][j]+"\t"); } System.out.print("\n"); } System.out.println("addition of matrix:"); for(i=0;i<n;i++){ for(j=0;j<n;j++){ c[i][j]=a[i][j]+b[i][j]; System.out.print(c[i][j]+"\t"); } System.out.print("\n"); } } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |