Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners matrix addition

Have Programming Question? Ask it here!
 
 
 


leelaprasad.ch
matrix addition
1 Answer(s)      3 years and 3 months ago
Posted in : Java Beginners


hai


Advertisement
View Answers

January 20, 2011 at 11:34 AM


Hi,

Try this:

import java.util.*;
class MatrixAddition{

    public static void main(String[] args){
     Scanner input = new Scanner(System.in);
    int[][] A = new int[3][3];
int[][] B = new int[3][3];
int[][] C = new int[3][3];
System.out.println("Enter elements for matrix A : ");
for (int i=0 ; i < A.length ; i++)
for  (int j=0 ; j < A[i].length ; j++){
A[i][j] = input.nextInt();
}
System.out.println("Enter elements for matrix B : ");
for (int i=0 ; i < B.length ; i++)
for  (int j=0 ; j < B[i].length ; j++){
B[i][j] = input.nextInt();
}
System.out.println("Matrix A: ");
        for (int i=0 ; i < A.length ; i++){
            System.out.println();
            for  (int j=0 ; j < A[i].length ; j++){
                System.out.print(A[i][j]+" ");
                  }
        }
System.out.println();
System.out.println();
System.out.println("Matrix B: ");
        for (int i=0 ; i < B.length ; i++){    
            System.out.println();
            for  (int j=0 ; j < B[i].length ; j++){
                System.out.print(B[i][j]+" ");
                  }
        }
System.out.println();
System.out.println();
System.out.println("Addition Of Matrices: ");
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
C[i][j]=A[i][j]+B[i][j];
System.out.print(C[i][j]+" ");
}
System.out.println();
}
}
}

Thanks



Related Tutorials/Questions & Answers:
matrix addition
matrix addition  hai
matrix addition
matrix addition  hai
Advertisements
Matrix Addition using RMI in Java
Matrix Addition using RMI in Java  Source Code for Matrix Addition using RMI in Java
matrix adddition
matrix adddition   how to write a program matrix addition in java
Java Matrix Addition Example
Java Matrix Addition Example In this tutorial, you will learn how to find the sum of two matrices. You may have solved many Matrix Operations in Mathematics... 2 3 4 5 6 2 1 3 Matrix B: 5 2 3 5 5 1 2 2 5 Addition Of Matrices
Matrix addition in java
Matrix addition in java In this section we will learn about addition of two...-dimensional array. Here we are going to develop a Java code for matrices addition, while adding two matrices the number of row and column of first matrix is equal
matrix substraction
matrix substraction  hai
matrix substraction
matrix substraction  hai
Java, matrix
. Addition Of Matrix"); System.out.println("2. Subtraction Of Matrix... of switch statement perform operations addition, subtraction and multiplication of matrix.   Hello Friend, Try this: import java.util.*; class
column matrix
column matrix  columan wise total matrix
column matrix
column matrix  columan wise total matrix
Matrix multiplication
Matrix multiplication  program to read the elements of the given two matrices of order n*n and to perform the matrix multiplication
Addition of JComboBoxItem
Addition of JComboBoxItem  how to add JComboBoxItem cb1=1,cb2=1/9 into a JTextField. thanks
transpose matrix
integers into the matrix and print the transpose of it. for this program u r given answer but if i entered 2 by 3 matrix it will not give answer ple check it once
Matrix Class
Matrix Class   A class to manage matrices and add them. Create in the driver class two objects of it and use the add method
Matrix Class
Matrix Class   A class to manage matrices and add them. Create in the driver class two objects of it and use the add method
transpose of matrix
transpose of matrix  write a program in java to declare a square matrices 'A' or order n which is less than 20.allow in user to input only positive integers into the matrix and print the transpose
matrix determination in java
matrix determination in java  hai
matrix polynamial addtion
matrix polynamial addtion  hai
Addition of two numbers
Addition of two numbers  addition of two numbers
Magic Matrix in GUI
Magic Matrix in GUI  I want program in java GUI contain magic matrix for numbers
Parallel multiplication matrix in java
Parallel multiplication matrix in java  hello dear I need parallel multiply matrix in java algorithm to account speed up and efficiency great wishes
matrix calculator - Java Beginners
matrix calculator  hi..... can you help me in writing source code of matrix calculator in java... i know you are the best you can do it!!! show yourself
parallel dense matrix multiplication
parallel dense matrix multiplication  hi friends, i am a final year... using dense parallel matrix multiplication. I request you to kindly provide me a code for Parallel Matrix multiplication on distributed systems using Java
Matrix Multiplication in Java
(); //p holding the number of rows for the second matrix q = in.nextInt(); // q holding the number of column for the second matrix...Matrix Multiplication in Java In this Java tutorial we will demonstrate you
Ansoff Matrix
The Ansoff matrix or Ansoff Growth matrix is an effective marketing planning... growth strategy. According to the Ansoff matrix, a business growth depends upon... product in a new or existing market. Based on this, factor Ansoff matrix
Matrix - Java Beginners
Matrix  give me the Matrix program   Hi friend, Code for Matrix Example in Java class MatrixExample{ public static void main(String[] args) { int array[][]= {{1,3,5},{2,4,6
Javascript matrix error
Javascript matrix error  This function blows up (without an error) whenever it is called function valid(n){ //n is a number 0-9 if(board...; } } where board is a global 3x3 Array matrix var board = new Array(3
MySQL Addition
MySQL Addition       MySQL Addition returns you the sum value of a specific column for a group in a table. The Aggregate function sum() is used to perform the addition in SQL
The GE Matrix
The GE matrix was developed by Mckinsey in 1970s for General Electric in order to overcome the various disadvantages associated with the BCG matrix. Since then, GE Matrix has been successfully deployed as an alternative in marketing
MySQL Addition
MySQL Addition       MySQL Addition returns you the sum value of the total counts in a table... The Tutorial illustrate an example from 'MySQL Addition'. To understand the example
Sum of two Matrix
Addition of both matrix : 9  9   12 11 14  16... Sum of  two Matrix       In this section, we are going to calculate the sum of two matrix
Preprocessor directive case for multiplication and addition
Preprocessor directive case for multiplication and addition  Preprocessor directive case for multiplication and addition include<stdio.h> define m 2+10 include<conio.h> int main() { int i; clrscr
code for multiplication of matrix in java using methods
code for multiplication of matrix in java using methods  code for multiplication of matrix in java using methods
The BCG Matrix
The BCG matrix also called the Growth share matrix, B-Box, B.C.G. analysis, Boston Box, Boston Matrix, Boston Consulting Group analysis, portfolio diagram... business units and product lines. In broader terms of management, the BCG matrix
Java create Identity matrix
Java create Identity matrix In this tutorial, you will learn how to create an identity or unit matrix. An identity matrix is a square matrix, of size n x n... elements are zeros. Here, we are going to create the unit matrix of arbitrary
how to create unit matrix in java of arbritary dimensions
how to create unit matrix in java of arbritary dimensions  i want to create the unit matrix of arbritary dimensions say (n*m).i m a new beginner to java.someone having the program for that? help would be appreciable
how to change file from .txt to .mat(matrix)
how to change file from .txt to .mat(matrix)  i have a big file.txt and i want to change this file to file.mat(matrix) ...this is in windows not on any os ..thx if u answering quickly please
Java Transpose of a matrix
Java Transpose of a matrix In this section, you will learn how to determine the transpose of a matrix.The transpose of a matrix is formed by interchanging the rows and columns of a matrix such that row i of matrix becomes column i
Find sum of all the elements of matrix using Java
Find sum of all the elements of matrix using Java A matrix is a rectangular array of numbers. The numbers in the matrix are called its entries or its elements. A matrix with m rows and n columns is called m-by-n matrix or m n matrix
Addition to my previous post - Java Beginners
Addition to my previous post  Addition to my previous question about the address book program. I need to have separate classes: CmdLineAddressBook.java AddressBook.java Contact.java Address.java Name.java
C Program for Addtion of 2*2 Diagnol Matrix - Development process
]=a[i][j]+b[i][j]; printf("\nThe Addition of two matrix is:\n"); for(i=0;i<...C Program for Addtion of 2*2 Diagnol Matrix   Hello Sir, I want C Program to Do Addtion of Diagnol Matrix in C language. Plz Give Me   Hi
Multiplication of two Matrix
Multiplication of Two Matrix   ... that teaches you the method to multiply two matrix. We are going to make a simple program that will multiply two matrix. Now to make this program run, you need
Find Sum of Diagonals of Matrix
Find Sum of Diagonals of Matrix You all know that a matrix is a rectangular array of numbers and these numbers in the matrix are called its entries or its...) of the matrix from the given two dimensional array. See the following matrix
Get the color values as a matrix of color image
Get the color values as a matrix of color image  I am new to java and image processing, i want to get the color values as a matrix from the color image for giving input to the compression algorithm by using java. plz provide
GE Matrix Diagram
GE Matrix Diagram Developed by Mckinsey in the 1970s for General Electric, GE matrix diagram is used to identify the position of the strategic business... portfolio and product management. GE (General Electric) matrix diagram
Multiplication of two Matrix
for multiplying two matrix to each other. Here providing you Java source code... program that will multiply two matrix. Two dimensional array represents the matrix.  Now, make this program, you have to declare two multidimensional array
want to display the follwing matrix format - Java Beginners
want to display the follwing matrix format  Hi frends, Actually i was working on the following matrix format........I neeed to use arraylist... gives 3 then he should get 3*3 matrix with folllowing data, and when user gives 4
Advertisements
 

 

 

DMCA.com