Write a java program for multiplying two matrices and print the product for the same | VCMIT

Two matrices and print the product for the same.


INPUT

public class Matrix1{
public static void main(String args[]){   
int a[][]={{1,1,1},{2,2,2},{3,3,3}}; 
int b[][]={{1,1,1},{2,2,2},{3,3,3}};     
int c[][]=new int[3][3];   
for(int i=0;i<3;i++){ 
for(int j=0;j<3;j++){ 
c[i][j]=0;   
for(int k=0;k<3;k++)   
{   
c[i][j]+=a[i][k]*b[k][j];   
}
System.out.print(c[i][j]+" "); 
}
System.out.println(); 

}}

OUTPUT



Disqus Comments
TheWaoFam. يتم التشغيل بواسطة Blogger.

إجمالي مرات مشاهدة الصفحة

بحث هذه المدونة الإلكترونية

  • ()

Random Posts

randomposts

Recent Posts

recentposts

Footer Link

Connected

Facebook

banner image

Most Recent

نموذج الاتصال

Categories

There are many variations of passages of Lorem Ipsum available.

About Me

Hi there, I’m Amanda – a girl love fashion and love to express herself with her own sense of style.

Trending