Earn by twitter on twivert

Sign up for PayPal and start accepting credit card payments instantly.
Showing posts with label matrix. Show all posts
Showing posts with label matrix. Show all posts

Thursday, March 29, 2012

WAP of Matrix Multiplication in Java


/*WAP of Matrix Multiplication in Java*/
import java.lang.*;
import java.io.*;
import java.util.*;
class matrix
{
 public static void main (String args[]) throws IOException
 {
  int a[][] = new int[2][2];
  int b[][] = new int[2][2];
  int c[][] = new int[2][2];
  
  Scanner sc = new Scanner(System.in);
  System.out.println("Enter Elements of Matrix 1");
  for(int i=0; i<2; i++)
  {
   for(int j=0; j<2; j++)
   {
   a[i][j] = sc.nextInt();
   }
  }

  System.out.println("Enter Elements of Matrix 2");
  for(int i=0; i<2; i++)
  {
   for(int j=0; j<2; j++)
   {
   b[i][j] = sc.nextInt();
   }
  }
  // calculation
  for(int i=0; i<2; i++)
  {
   for(int j=0; j<2; j++)
   {
    for(int k=0; k<2; k++)
    {
   c[i][j] += a[i][k] * b[k][j];
    }
   }
  }
  System.out.println("Matrix After multiplication");
  for(int i=0; i<2; i++)
  {
   for(int j=0; j<2; j++)
   {
   System.out.println( "\t" + c[i][j] );
   }
  }
 }
}

Sunday, July 4, 2010

WAP to find out matrix multipl


/*To find out matrix multipl*/
import java.lang.*;
class Matrix
{
        int l[][],m[][],n[][];
        Matrix()
        {
        l=new int[][] {{1,2,3},{4,5,6},{7,8,9}};
        m=new int[][] {{1,2,3},{4,5,6},{7,8,9}};
        n=new int[3][3];
        }
        void display()
        {
        for(int i=0;i<3;i++)
        {
        for(int j=0;j<3;j++)
        {
        for(int k=0;k<3;k++)
        {

                n[i][j]=n[i][j]+(l[i][k]*m[k][j]);
               
        }
                System.out.print("  "+n[i][j]);
                
        }
                System.out.println(" ");
        }
        }
}
class Matrix_multipl
{
        public static void main(String arg[])
        {
        Matrix a1=new Matrix();
        a1.display();
       
        }
}

Saturday, May 29, 2010

To find out 2D matrix addition


/*To find out 2D matrix addition*/
/*Save file as: Matrix_Additon.java*/

import java.lang.*;
class Matrix
{
        int l[][],m[][],n[][];
        Matrix()
        {
        l=new int[][] {{1,2,3},{4,5,6},{7,8,9}};
        m=new int[][] {{1,2,3},{4,5,6},{7,8,9}};
        n=new int[3][3];
        }
        void display()
        {
        for(int i=0;i<3;i++)
        {
        for(int j=0;j<3;j++)
        {
  n[i][j]=l[i][j]+m[i][j];        
   System.out.print("  "+n[i][j]);
                
        }
                System.out.println(" ");
        }
        }
}
class Matrix_Additon
{
        public static void main(String arg[])
        {
        Matrix a1=new Matrix();
        a1.display();
 }
}

Saturday, May 15, 2010

WAP to multiplication of 2 matrix


/*WAP to multiplication of 2 matrix*/

#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],b[2][2],c[2][2],i,j,k;
clrscr();
printf("enter 1 matrix");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("enter 2 matrix");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c[i][j]=0;
for(k=0;k<2;k++)
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}
printf("multiplication of 2 matrix");
for(i=0;i<2;i++)
{
printf("\n");
for(j=0;j<2;j++)
{
printf("%d\t",c[i][j]);
}
}
getch();
}

ADS

How to earn online

How to earn online:
Step - 1 :
signup for PayPal, to recieve your online earning
click here:
https://www.paypal.com/in/mrb/pal=CZ7224TZBMCBL
step - 2 : Singup these 4 sites & earn & enjoy! Read site to know how to earn.
1. trekpay
Earn up to $0.02 (2 cents) per click.
http://www.trekpay.com/?ref=34690
2. neobux
Earn up to $0.02 (2 cents) per click.
Click here:
http://www.neobux.com/?r=Moneyearner786

AddMe

Bookmark and Share