Learn It
Learn It
Place all elements of P array and Q array in the array R one after the other.
Question 2:
If A[][] is a double dimensional array, calculate the number of rows( M) and number
of columns(C).
class Sample
for(int i=0;i<a.length;i++)
System.out.println(a[i][j]+ “ ”);
}
System.out.println();
Question 3:
A square matrix is said to be Symmetric if the element of ith row is equal to the jth column.
Write a program to create a 3X3 matrix , display it and check whether it is a Symmetric
matrix or not.
Example:
1 2 3
2 4 5
3 5 6
import java.util.*;
class Symetric
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
System.out.println("Enter a number:");
A[i][j]=sc.nextInt();
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
System.out.print(A[i][j]+"\t");
System.out.println();
int f=0;
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
f=1;
break;
if(f==0)
else