Write a java program to add two matrices and print the resultant matrix | VCMIT


Add two matrices and print the resultant matrix.


INPUT

public class Matrix{
public static void main(String args[]){ 
int a[][]={{1,3,4},{2,4,3},{3,4,5}}; 
int b[][]={{1,3,4},{2,4,3},{1,2,4}};   
int c[][]=new int[3][3];   
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(); 

}}

OUTPUT



Disqus Comments
TheWaoFam. Powered by Blogger.

Total Pageviews

Search This Blog

  • ()

Random Posts

randomposts

Recent Posts

recentposts

Footer Link

Connected

Facebook

banner image

Most Recent

Contact Form

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