Join Sarthaks eConnect Today - Largest Online Education Community!
0 votes
22 views
asked in Computer by (71.6k points)

WAP in JAVA to create a square matrix of 3 * 3 and store numbers in it. Check whether the matrix is symmetric on not. A square matrix is said to be symmetric, if the element of the ith row and the column is equal to the element of jth row and ith coloum. e.g.

1 2 3

2 4 5

3 5 6

1 Answer

+1 vote
answered by (67.6k points)
selected by
 
Best answer

public class dsymmetric

{

public static void main (String args [ ])

{

int i, j, k;

k = 0;

int m [ ] [ ] = new int [3] [3] ;

System.out.print In (“The no. of matrix one”); 

for (i = 0; i < 3; i ++)

{

for (j = 0; j < 3; j ++)

{

System.out.print (m [i] [j] + “ ”); 

}

System.out.printIn ();

}

for (i = 0; i < 3; i ++)

for (j = 0; j x 3; j ++)

{

eg (m[i][j] ! = m [j][i] k = 1; 

}

}

if (k = 0)

System.out.print In (“It is symmetric”);

else

System.out.print In (“It is not symmetric”);

}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

One Thought Forever

“There is a close connection between getting up in the world and getting up in the morning.“
– Anon
~~~*****~~~

Categories

...