JAVA_CODINGS Telegram 74
54. Matrix Addition.

import java.util.Scanner;

class MatrixAddition {

Scanner scan;
int matrix1[][], matrix2[][], sum[][];
int row, column;

void create() {

scan = new Scanner(System.in);

System.out.println("Matrix Addition");

// First Matrix Creation..
System.out.println("\nEnter number of rows & columns");
row = Integer.parseInt(scan.nextLine());
column = Integer.parseInt(scan.nextLine());

matrix1 = new int[row][column];
matrix2 = new int[row][column];
sum = new int[row][column];

System.out.println("Enter the data for first matrix :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

matrix1[i][j] = scan.nextInt();
}
}

// Second Matrix Creation..
System.out.println("Enter the data for second matrix :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

matrix2[i][j] = scan.nextInt();
}
}
}

void display() {

System.out.println("\nThe First Matrix is :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

System.out.print("\t" + matrix1[i][j]);
}
System.out.println();
}

System.out.println("\n\nThe Second Matrix is :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

System.out.print("\t" + matrix2[i][j]);
}
System.out.println();
}
}

void add() {

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

sum[i][j] = matrix1[i][j] + matrix2[i][j];
}
}

System.out.println("\n\nThe Sum is :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

System.out.print("\t" + sum[i][j]);
}
System.out.println();
}
}
}

class MatrixAdditionExample {

public static void main(String args[]) {

MatrixAddition obj = new MatrixAddition();

obj.create();
obj.display();
obj.add();
}
}

@java_codings



tgoop.com/java_codings/74
Create:
Last Update:

54. Matrix Addition.

import java.util.Scanner;

class MatrixAddition {

Scanner scan;
int matrix1[][], matrix2[][], sum[][];
int row, column;

void create() {

scan = new Scanner(System.in);

System.out.println("Matrix Addition");

// First Matrix Creation..
System.out.println("\nEnter number of rows & columns");
row = Integer.parseInt(scan.nextLine());
column = Integer.parseInt(scan.nextLine());

matrix1 = new int[row][column];
matrix2 = new int[row][column];
sum = new int[row][column];

System.out.println("Enter the data for first matrix :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

matrix1[i][j] = scan.nextInt();
}
}

// Second Matrix Creation..
System.out.println("Enter the data for second matrix :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

matrix2[i][j] = scan.nextInt();
}
}
}

void display() {

System.out.println("\nThe First Matrix is :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

System.out.print("\t" + matrix1[i][j]);
}
System.out.println();
}

System.out.println("\n\nThe Second Matrix is :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

System.out.print("\t" + matrix2[i][j]);
}
System.out.println();
}
}

void add() {

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

sum[i][j] = matrix1[i][j] + matrix2[i][j];
}
}

System.out.println("\n\nThe Sum is :");

for(int i=0; i &lt row; i++) {

for(int j=0; j &lt column; j++) {

System.out.print("\t" + sum[i][j]);
}
System.out.println();
}
}
}

class MatrixAdditionExample {

public static void main(String args[]) {

MatrixAddition obj = new MatrixAddition();

obj.create();
obj.display();
obj.add();
}
}

@java_codings

BY Advance Java 👨‍💻


Share with your friend now:
tgoop.com/java_codings/74

View MORE
Open in Telegram


Telegram News

Date: |

On Tuesday, some local media outlets included Sing Tao Daily cited sources as saying the Hong Kong government was considering restricting access to Telegram. Privacy Commissioner for Personal Data Ada Chung told to the Legislative Council on Monday that government officials, police and lawmakers remain the targets of “doxxing” despite a privacy law amendment last year that criminalised the malicious disclosure of personal information. The imprisonment came as Telegram said it was "surprised" by claims that privacy commissioner Ada Chung Lai-ling is seeking to block the messaging app due to doxxing content targeting police and politicians. Matt Hussey, editorial director at NEAR Protocol also responded to this news with “#meIRL”. Just as you search “Bear Market Screaming” in Telegram, you will see a Pepe frog yelling as the group’s featured image. Telegram channels fall into two types: How to Create a Private or Public Channel on Telegram?
from us


Telegram Advance Java 👨‍💻
FROM American