Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
2.3k views
in Computer by (73.2k 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
by (69.2k 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.

Categories

...