0% found this document useful (0 votes)
11 views

5.3 Matric Addition Scanner Class

Uploaded by

mrnirajbro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

5.3 Matric Addition Scanner Class

Uploaded by

mrnirajbro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.util.

Scanner;

public class Arryadd {

public static void main(String[] args) {


Scanner sc = new Scanner(System.in);

int a[][] = new int[2][2];


int b[][]=new int[2][2];
int c[][] = new int[2][2];
int i,j;

System.out.println("Enter the elements of the array:");


for ( i = 0; i < 2; i++) {
for(j=0;j<2;j++)
{

a[i][j] = sc.nextInt();
}}

System.out.println("Enter e elements of the array:");


for ( i = 0; i < 2; i++) {
for(j=0;j<2;j++)
{

b[i][j] = sc.nextInt();
}}

// matric addition
for ( i = 0; i < 2; i++) {
for(j=0;j<2;j++)
{

c[i][j] = a[i][j]+b[i][j];
}}
System.out.println("Addition of matrix:");
for ( i = 0; i < 2; i++) {
for(j=0;j<2;j++)
{
System.out.println(c[i][j]+"");
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy