Page 587 - Computer science 868 Class 12
P. 587
Enter Binary Number: 101
The Added Binary Result is:
1011000
PROGRAMS ON TWO DIMENSIONAL ARRAY
Program 8 Transpose and Symmetric matrix
Create a class trans_array to find the transpose of a matrix and check it is symmetric or not.
A symmetric matrix is one which is equal to its transpose.
Class name : trans_array
Data Members
int m,n : To store size of row and column respectively
int arr[][] : to store array
in ar[][] : to store transpose array
Member Function
trans_array(int, int) : to initialise m as a and n as b
void inputdata() : to input the numbers in the original array arr[][]
void transpose() : to generate the transpose matrix of arr[][]in ar[][]
void display() : to display the original as well as transpose
void symmetric() : checks the matrix is symmetric or not
1 import java.util.*;
2 class trans_array
3 {
4 int m,n;
5 int arr[][],ar[][];
6 trans_array(int a,int b)
7 {
8 m=a;
9 n=b;
10 arr=new int[m][n];
11 ar=new int[n][m];
12 }
13 void inputdata()
14 {
15 Scanner sc=new Scanner(System.in);
16 int i,j;
17 System.out.println("Enter a Number:");
585
Internal Assessment 585

