تفاصيل العمل

Problem 1: Transpose of a Matrix Using Functions

Description:(Note You must adhere with the given arguments)

Write a program that uses four functions to handle matrix operations:

1. Input Matrix Function inputMatrix(nRows, nCols)

o Accepts nRows (rows) and nCols (columns) as arguments.

o Asks the user to input matrix elements and return the matrix

2. Transpose Function transposeMatrix (matrix, rows, cols)

o Accepts the original matrix and its dimensions.

o Transposes the matrix and returns the new matrix.

3. Print Matrix Function printMatrix (transposedMatrix, rows, cols)

o Accepts a matrix and its dimensions.

o Prints the transposed matrix in a formatted way.

4. Is Symmetric Function isSymmetric (matrix, rows, cols) Returns

true if transposed matrix = original matrix otherwise returns false.

-----------------------------------------------------------------------------------------

Problem 2: Verify Identity Matrix

Description:(Note You must adhere with the given arguments)

Write a program with two functions to verify if a given matrix is an

identity matrix:

1. Input Matrix Function inputMatrix(nRows, nCols)

o Accepts nRows (rows) and nCols (columns) as arguments.

o Asks the user to input matrix elements and return the matrix.

2. Is Identity Function isIdentity (Matrix, nRows, nCols)

o Accepts the matrix and its dimensions.

o Returns true if matrix is an identity, otherwise returns false.

An identity matrix is a square matrix where:

1. All diagonal elements are 1.

2. All non-diagonal elements are 0.

-----------------------------------------------------------------------------------------

Problem 3: Convert a 1D Array into a Matrix

Description: (Note Make each operation into function)

1. Convert the 1D array into a 2D matrix of user-specified dimensions.

2. Sum of each row => return array contains sum of each row

3. Sum of each column => return array contains sum of each column

4. Sum of each diagonal => return array contains sum of each diagonal

ملفات مرفقة

بطاقة العمل

اسم المستقل
عدد الإعجابات
0
عدد المشاهدات
1
تاريخ الإضافة
تاريخ الإنجاز
المهارات