Untitled
Never
import java.util.Scanner; public class sumofarr { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter the number of rows: "); int rows = sc.nextInt(); System.out.print("Enter the number of columns: "); int columns = sc.nextInt(); double[][] matrix1 = new double[rows][columns]; System.out.println("Enter the elements of the first matrix:"); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { matrix1[i][j] = sc.nextDouble(); } } double[][] matrix2 = new double[rows][columns]; System.out.println("Enter the elements of the second matrix:"); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { matrix2[i][j] = sc.nextDouble(); } } double[][] resultMatrix = new double[rows][columns]; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { resultMatrix[i][j] = matrix1[i][j] + matrix2[i][j]; } } System.out.println("The sum of the two matrices is:"); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { System.out.print(resultMatrix[i][j] + " "); } System.out.println(); } } }
Raw Text
-
inc3st with kids Mega Folders
8 min ago
-
FOLDERS 💯📁 CP😈 VIDEOS R@PED😏 GIRLS♥️👧💦
25 min ago
-
Adult Telegram Channels
34 min ago
-
ytyrf dgchggkj hghfgfdgf
36 min ago
-
g v vb rtgfbv gb
39 min ago
-
Invite link by Chester G
47 min ago
-
Link video viral G
50 min ago
-
t4grfbv4tgbtrhgb
50 min ago
-
yhgnb ghn ythnyhn
51 min ago
-
Cause why not v G
51 min ago