Viết tập lệnh php bằng cách sử dụng mảng hai chiều, chẳng hạn như thao tác chuyển vị của ma trận 3x3

Trong chương trình này, người dùng được yêu cầu nhập số hàng r và cột c. Sau đó, người dùng được yêu cầu nhập các phần tử của hai ma trận (theo thứ tự rxc)

Sau đó ta cộng các phần tử tương ứng của hai ma trận và lưu vào một ma trận khác (mảng hai chiều). Cuối cùng, kết quả được in ra màn hình

Thật dễ dàng để nhân một ma trận với một đại lượng vô hướng. Chỉ cần nhân mỗi số trong ma trận với vô hướng

Ví dụ

const mA = toán học. ma trận([[1, 2], [3, 4], [5, 6]]);

// Phép nhân ma trận
const matrixMult = toán học. nhân(2, mA);

// Kết quả [ [2, 4], [6, 8], [10, 12] ]

Tự mình thử »

Ví dụ

const mA = toán học. ma trận([[0, 2], [4, 6], [8, 10]]);

// Phép chia ma trận
const matrixDiv = toán học. chia(mA, 2);

// Kết quả [ [0, 1], [2, 3], [4, 5] ]

Tự mình thử »


Hoán vị một ma trận

Để chuyển đổi ma trận, có nghĩa là thay thế các hàng bằng các cột

Khi bạn hoán đổi hàng và cột, bạn xoay ma trận xung quanh đường chéo của nó


nhân ma trận

Nhân ma trận khó hơn

Ta chỉ có thể nhân hai ma trận nếu số hàng của ma trận A bằng số cột của ma trận B

Sau đó, chúng ta cần biên dịch một "sản phẩm chấm"

Ta cần nhân các số ở mỗi hàng của A với các số ở mỗi cột của B, rồi cộng các tích

Chuyển vị của một ma trận (mảng 2-D) chỉ đơn giản là một phiên bản đảo ngược của ma trận gốc (mảng 2-D). Chúng ta có thể hoán vị một ma trận (mảng 2 chiều) bằng cách chuyển đổi các hàng của nó với các cột của nó

Giả sử sau đây là mảng 2d của chúng ta -

const arr = [
   [1, 1, 1],
   [2, 2, 2],
   [3, 3, 3],
];

Hãy viết mã cho chức năng này -

Ví dụ

Sau đây là mã -

const arr = [
   [1, 1, 1],
   [2, 2, 2],
   [3, 3, 3],
];
const transpose = arr => {
   for (let i = 0; i < arr.length; i++) {
      for (let j = 0; j < i; j++) {
         const tmp = arr[i][j];
         arr[i][j] = arr[j][i];
         arr[j][i] = tmp;
      };
   }
}
transpose(arr);
console.log(arr);

đầu ra

Đầu ra trong bảng điều khiển. -

[ [ 1, 2, 3 ], [ 1, 2, 3 ], [ 1, 2, 3 ] ]

Viết tập lệnh php bằng cách sử dụng mảng hai chiều, chẳng hạn như thao tác chuyển vị của ma trận 3x3


Viết tập lệnh php bằng cách sử dụng mảng hai chiều, chẳng hạn như thao tác chuyển vị của ma trận 3x3

TÊN TỆP. mảng hai chiều. php

MÃ SỐ

$a = mảng(mảng(11,4),mảng(2,3));

$b = mảng(mảng(3,2),mảng(4,11));

echo “ADDITION OF 2X2 MATRICES”.”

”;

for($i = 0; $i < 2; $i++)

{

cho($j = 0; $j < 2; $j++)

{

tiếng vang $a[$i][$j] + $b[$i][$j]. ” “;

}

echo “
”;

}

?>

ĐẦU RA

Viết tập lệnh php bằng cách sử dụng mảng hai chiều, chẳng hạn như thao tác chuyển vị của ma trận 3x3

Quảng cáo

Chia sẻ cái này

  • Twitter
  • Facebook

Như thế này

Thích Đang tải.

Có liên quan

Chuyển vị của ma trận thu được bằng cách thay đổi hàng thành cột và cột thành hàng. Nói cách khác, chuyển vị của A[N][M] có được bằng cách thay đổi A[i][j] thành A[j][i]

Thí dụ

Viết tập lệnh php bằng cách sử dụng mảng hai chiều, chẳng hạn như thao tác chuyển vị của ma trận 3x3

Khuyến khích. Vui lòng giải quyết nó trên “PRACTICE” trước khi chuyển sang giải pháp.  
 

Tiếp cận. Thực hiện theo các bước đã cho để giải quyết vấn đề

  • Chạy một vòng lặp lồng nhau sử dụng hai con trỏ số nguyên i và j cho 0 <= i < N và 0 <= j < M
  • Đặt B[i][j] bằng A[j][i]

Dưới đây là việc thực hiện các phương pháp trên

C++




// C++ program to find

// transpose of a matrix

#include

using namespace std;

#define N 4

 

// This function stores transpose

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
2_______3_______3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
4
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
6

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 // C++ program to find0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2 // C++ program to find3

// C++ program to find4_______362_______2 // C++ program to find6

// C++ program to find7// C++ program to find8

// C++ program to find9

 

// transpose of a matrix0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 // transpose of a matrix2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 // transpose of a matrix6

// transpose of a matrix7// transpose of a matrix8

// transpose of a matrix7#include 0

// transpose of a matrix7#include 2

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8#include 4

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 7

 

#include 8#include 9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8using1

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8using3_______365_______4using5

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2 using8

// C++ program to find4_______362_______2 // C++ program to find6

// C++ program to find7using3namespace4 namespace5

 

// C++ program to find4_______365_______3namespace8using5

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8std;3 std;4

// C++ program to find9

 

std;6

C




std;7

// transpose of a matrix

 

std;9

#define N 4

 

#define N 41

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
2_______3_______3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
4
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
6

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 // C++ program to find0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2 // C++ program to find3

// C++ program to find4_______362_______2 // C++ program to find6

// C++ program to find7// C++ program to find8

// C++ program to find9

 

// transpose of a matrix0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 // transpose of a matrix2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 // transpose of a matrix6

// transpose of a matrix7// transpose of a matrix8

// transpose of a matrix7#include 0

// transpose of a matrix7#include 2

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8#include 4

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 7

 

#include 8#include 9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8using1

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
24
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25using4
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2 using8

// C++ program to find4_______362_______2 // C++ program to find6

// C++ program to find7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
24_______3_______25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
37
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
38

// C++ program to find4_______3_______24

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25namespace8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8std;3 std;4

// C++ program to find9

Java




Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
50

// transpose of a matrix

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
52
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
53

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
56
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
58
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59using5

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// This function stores transpose

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
70
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
72

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

// C++ program to find4______3_______3 // C++ program to find0

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
80
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
81
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
82

// C++ program to find7// C++ program to find2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
85
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
81
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
87

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88// C++ program to find8

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// transpose of a matrix0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
95
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
98

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

// C++ program to find4_______3_______3 // C++ program to find03// C++ program to find04// C++ program to find05// C++ program to find04// C++ program to find05// C++ program to find04// C++ program to find05// C++ program to find04 // C++ program to find11

// C++ program to find12_______3_______7// C++ program to find14// C++ program to find05// C++ program to find14// C++ program to find05// C++ program to find14// C++ program to find05// C++ program to find14 // C++ program to find11

// C++ program to find12_______3_______7// C++ program to find24// C++ program to find05// C++ program to find24// C++ program to find05// C++ program to find24// C++ program to find05// C++ program to find24 // C++ program to find11

// C++ program to find12_______3_______7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59_______362_______05
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59// C++ program to find05
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59_______362_______05_______3_______59 // C++ program to find41

 

// C++ program to find4_______3_______3 // C++ program to find44// C++ program to find45

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3// C++ program to find47

 

// C++ program to find48#include 9

// C++ program to find4_______365_______1

 

// C++ program to find4_______362_______53using4

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
80
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
81// C++ program to find60

// C++ program to find7// C++ program to find2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
85
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
81
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
87

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88// C++ program to find67namespace4
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find7// C++ program to find53namespace8

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find4______362_______9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

// C++ program to find9

 

// C++ program to find79

Python3




// C++ program to find80

// C++ program to find81

 

// C++ program to find82// C++ program to find83

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59

 

// C++ program to find85

// C++ program to find86

 

 

// C++ program to find87 // C++ program to find88

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2 // C++ program to find91// C++ program to find92 // C++ program to find93// C++ program to find94

// C++ program to find4_______362_______2 // C++ program to find97// C++ program to find92 // C++ program to find93// C++ program to find94

// C++ program to find7// transpose of a matrix02// C++ program to find83 // transpose of a matrix04

 

 

// transpose of a matrix05

// transpose of a matrix06 // transpose of a matrix07// C++ program to find83// C++ program to find83 // transpose of a matrix10// transpose of a matrix11

// transpose of a matrix12_______363_______13____362_______83 // transpose of a matrix15// C++ program to find04// C++ program to find05// C++ program to find04// C++ program to find05// C++ program to find04// C++ program to find05// C++ program to find04// transpose of a matrix23

// transpose of a matrix24// transpose of a matrix25// C++ program to find14_______362_______05// C++ program to find14// C++ program to find05// C++ program to find14// C++ program to find05// C++ program to find14// transpose of a matrix23

// transpose of a matrix24// transpose of a matrix25// C++ program to find24_______362_______05// C++ program to find24// C++ program to find05// C++ program to find24// C++ program to find05// C++ program to find24// transpose of a matrix23

// transpose of a matrix24// transpose of a matrix25_______3_______59// C++ program to find05

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59// C++ program to find05
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59// C++ program to find05
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59// transpose of a matrix53

 

 

// transpose of a matrix12______363_______55

// transpose of a matrix12_______363_______57____362_______83 // transpose of a matrix15

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
81 // C++ program to find2 // transpose of a matrix62____362_______92 // C++ program to find93// transpose of a matrix65// C++ program to find2 // transpose of a matrix67// C++ program to find92 // C++ program to find93_______363_______65

 

// transpose of a matrix12______363_______72

// transpose of a matrix12______363_______74

 

// transpose of a matrix12_______363_______76____3_______25// transpose of a matrix78// transpose of a matrix79

// transpose of a matrix12_______362_______2 // C++ program to find91____362_______92 // C++ program to find93// C++ program to find94

#include 8// C++ program to find2 // C++ program to find97// C++ program to find92 // C++ program to find93// C++ program to find94

// C++ program to find48// transpose of a matrix76_______363_______94____366_______4// transpose of a matrix96// C++ program to find83// transpose of a matrix98

#include 8____363_______76#include 01

C#




#include 02

// transpose of a matrix

using #include 05

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
52
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
53

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 11

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// This function stores transpose

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3#include 21
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3#include 23

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

// C++ program to find4______3_______3 // C++ program to find0

// C++ program to find4_______362_______2 // C++ program to find3

// C++ program to find7// C++ program to find2 // C++ program to find6

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88#include 36

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// transpose of a matrix0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
95
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 #include 45

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

// C++ program to find4_______3_______3#include 50

// C++ program to find12______363_______8

// C++ program to find12______364_______0

// C++ program to find12______364_______2

 

// C++ program to find4_______3_______3#include 59// C++ program to find45

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3#include 62

 

// C++ program to find48#include 9

// C++ program to find4_______365_______1

 

// C++ program to find4_______364_______68using4

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 75

// C++ program to find7// C++ program to find2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 80

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88#include 82____366_______4
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find7#include 86namespace8

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find4______362_______9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

// C++ program to find9

 

#include 94

PHP




#include 95

 

// This function stores transpose

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
0

#include 98 #include 99using00using01using02// transpose of a matrix79

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8using06 using07

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25_______365_______11 using12using11 using14using06using5using11using18

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25_______365_______22 using12using22 using14using06using5using22using18

// C++ program to find7using02// transpose of a matrix25using11using34using22using36using00// transpose of a matrix25using22using34using11using42

// C++ program to find9

 

// transpose of a matrix0

 

using00 // C++ program to find83____365_______47

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25using47using50

using51______365_______47using53

using51______365_______47using56

using51______365_______47using59

 

using06 using07

 

#include 9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
2_______365_______00// C++ program to find05using02
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

 

using68 using4using5

// C++ program to find2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25using11 using12using11 using14using06using5using11using18

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25_______365_______22 using12using22 using14using06using5using22using18

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8using68 using02// transpose of a matrix25using11using34using22using42

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8using68 namespace4using5

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8using68 namespace8using5

// C++ program to find9

 

namespace14

namespace15

namespace16

Javascript




namespace17

namespace18

namespace19

 

namespace20namespace21 #include 11

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// This function stores transpose

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8namespace26

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8#include 98 namespace29

// C++ program to find4_______366_______21 // C++ program to find0

// C++ program to find4_______362_______2 // C++ program to find3

// C++ program to find7// C++ program to find2 // C++ program to find6

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88// C++ program to find8

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// transpose of a matrix0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8

// C++ program to find4_______366_______21 namespace48

 

// C++ program to find4_______366_______21 namespace51

// C++ program to find4_______362_______2namespace54

// C++ program to find4_______366_______56

 

// C++ program to find4_______365_______1

 

// C++ program to find4_______366_______60namespace61

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find4_______362_______2 using8

// C++ program to find7// C++ program to find2 // C++ program to find6

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88namespace70namespace4
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find7namespace60namespace75

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find4______362_______9

namespace79

namespace80

Đầu ra

Result matrix is 
 1 2 3 4
 1 2 3 4
 1 2 3 4
 1 2 3 4

Độ phức tạp về thời gian. O(M x N)
Không gian phụ trợ. O(M x N), vì M x N không gian thừa đã được sử dụng

Chương trình tìm chuyển vị của ma trận sử dụng không gian không đổi

Thực hiện theo các bước đã cho để giải quyết vấn đề

  • Chạy một vòng lặp lồng nhau sử dụng hai con trỏ số nguyên i và j cho 0 <= i < N và 0 <= j < M
  • Hoán đổi A[i][j] với A[j][i]

Dưới đây là việc thực hiện các phương pháp trên

C++




#include

using namespace std;

 

#define N 4

 

namespace86

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 namespace90

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 namespace96

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 std;01

// C++ program to find7std;03

// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 // transpose of a matrix2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 // transpose of a matrix6

// transpose of a matrix7// transpose of a matrix8

// transpose of a matrix7#include 0

// transpose of a matrix7#include 2

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8std;18

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
24
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25std;22
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 75

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 80

// C++ program to find7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
24
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
37std;38

// C++ program to find4_______3_______24

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25namespace8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8std;3 std;4

// C++ program to find9

Java




Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
50

// transpose of a matrix

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
52
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
53

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
56
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
58
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59using5

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8std;62

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 std;68

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 std;75
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
81
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
82

// C++ program to find7// C++ program to find2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 std;82// C++ program to find04std;84

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 std;87

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88std;89

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88std;91

// C++ program to find7// C++ program to find9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// transpose of a matrix0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
95
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
98

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

// C++ program to find4_______3_______3 // C++ program to find03// C++ program to find04// C++ program to find05// C++ program to find04// C++ program to find05// C++ program to find04// C++ program to find05// C++ program to find04 // C++ program to find11

// C++ program to find12_______3_______7// C++ program to find14// C++ program to find05// C++ program to find14// C++ program to find05// C++ program to find14// C++ program to find05// C++ program to find14 // C++ program to find11

// C++ program to find12_______3_______7// C++ program to find24// C++ program to find05// C++ program to find24// C++ program to find05// C++ program to find24// C++ program to find05// C++ program to find24 // C++ program to find11

// C++ program to find12_______3_______7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59_______362_______05
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59// C++ program to find05
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59_______362_______05_______3_______59 // C++ program to find41

 

// C++ program to find4_______367_______18

 

// C++ program to find4_______362_______53____367_______22

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 std;75
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
81// C++ program to find60

// C++ program to find7// C++ program to find2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #define N 463
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
81
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
87

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88#define N 467namespace4
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find7// C++ program to find53namespace8

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find4______362_______9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

// C++ program to find9

Python3




// C++ program to find80

// C++ program to find81

 

// C++ program to find82// C++ program to find83

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59

 

#define N 484

 

 

// C++ program to find87 #define N 486

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2 // C++ program to find91// C++ program to find92 // C++ program to find93// C++ program to find94

// C++ program to find4_______362_______2 // C++ program to find97// C++ program to find92 // C++ program to find93#define N 498#define N 499// C++ program to find04// This function stores transpose01

// C++ program to find7____369_______03____362_______83 // This function stores transpose05

 

 

// This function stores transpose06

// transpose of a matrix13_______362_______83 // transpose of a matrix15// C++ program to find04// C++ program to find05// C++ program to find04// C++ program to find05// C++ program to find04// C++ program to find05// C++ program to find04// transpose of a matrix23

namespace20// transpose of a matrix25// C++ program to find14// C++ program to find05// C++ program to find14// C++ program to find05// C++ program to find14// C++ program to find05// C++ program to find14// transpose of a matrix23

namespace20// transpose of a matrix25// C++ program to find24// C++ program to find05// C++ program to find24// C++ program to find05// C++ program to find24// C++ program to find05// C++ program to find24// transpose of a matrix23

namespace20// transpose of a matrix25_______3_______59// C++ program to find05

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59// C++ program to find05
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59// C++ program to find05
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
59// transpose of a matrix53

 

// This function stores transpose48

 

// transpose of a matrix76

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25// This function stores transpose51// transpose of a matrix79

// C++ program to find2 // C++ program to find91// C++ program to find92 // C++ program to find93// C++ program to find94

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2 // C++ program to find97// C++ program to find92 // C++ program to find93// C++ program to find94

// C++ program to find4_______363_______76____369_______66namespace4// transpose of a matrix96// C++ program to find83// transpose of a matrix98

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// transpose of a matrix76#include 01

 

// This function stores transpose74

// This function stores transpose75

C#




// This function stores transpose76

// This function stores transpose77

using #include 05

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
52
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
53

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 11

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8std;62

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3// This function stores transpose93

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 namespace96

// C++ program to find7// C++ program to find2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
005

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
008

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
010

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
012

// C++ program to find7// C++ program to find9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// transpose of a matrix0

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
95
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
55
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 #include 45

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

// C++ program to find4_______3_______3#include 50

// C++ program to find12______363_______8

// C++ program to find12______364_______0

// C++ program to find12______364_______2

 

// C++ program to find4_______367_______18

 

// C++ program to find4_______364_______68

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
039
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 75

// C++ program to find7// C++ program to find2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
3 #include 80

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
052namespace4
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

 

// C++ program to find7____3_______056

// C++ program to find4______362_______9

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find9

// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
062

PHP




#include 95

namespace86

#include 98 #include 99using00// transpose of a matrix79

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8using06 using07

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25_______365_______11 using12using11 using14using06using5using11using18

// C++ program to find4_______362_______2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25using22 // C++ program to find83using11
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
090using22 using14using06using5using22using18

// C++ program to find7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
100 // C++ program to find83using00// transpose of a matrix25using11using34using22using42

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88using00// transpose of a matrix25using11using34using22using36using00// transpose of a matrix25using22using34using11using42

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
88using00// transpose of a matrix25using22using34using11using36
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
100using5

// C++ program to find7// C++ program to find9

// C++ program to find9

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
133

using06 using07

using00 // C++ program to find83____365_______47

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25using47using50

// C++ program to find7____365_______47using53

using51______365_______47using56

using51______365_______47using59

 

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
2_______365_______00
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
27

 

using68

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
039
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
156namespace8using5

// C++ program to find2

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25using11 using12using11 using14using06using5using11using18

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
7

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
8// C++ program to find2
Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
25_______365_______22 using12using22 using14using06using5using22using18

// C++ program to find4_______365_______68 using00// transpose of a matrix25using11using34using22

Modified matrix is 
1 2 3 4 
1 2 3 4 
1 2 3 4 
1 2 3 4 
188namespace4using5

Mảng nhiều chiều là gì Cho ví dụ về mảng 2 chiều?

Mảng nhiều chiều là mảng có nhiều cấp hoặc nhiều chiều . Ví dụ: mảng 2D hoặc mảng hai chiều là một mảng của các mảng, nghĩa là nó là một ma trận gồm các hàng và cột (nghĩ về một bảng). Một mảng 3D thêm một chiều khác, biến nó thành một mảng của mảng của mảng.

Mảng đa chiều trong PHP là gì giải thích nó bằng PHP đơn giản?

Mảng nhiều chiều là mảng chứa một hoặc nhiều mảng . PHP hỗ trợ các mảng đa chiều có độ sâu hai, ba, bốn, năm hoặc nhiều cấp độ hơn. Tuy nhiên, mảng sâu hơn ba cấp khó quản lý đối với hầu hết mọi người.

Làm thế nào bạn có thể tạo một mảng nhiều chiều trong PHP?

Bạn tạo một mảng nhiều chiều sử dụng cấu trúc array() , giống như tạo một mảng thông thường. Sự khác biệt là mỗi phần tử trong mảng bạn tạo chính là một mảng. Ví dụ. $myArray = mảng(mảng(giá trị1,giá trị2,giá trị3),mảng(giá trị4,giá trị5,giá trị6),mảng(giá trị7,giá trị8,giá trị9));

cú pháp của hai là gì

Để tạo mảng hai chiều trong Java, bạn phải chỉ định kiểu dữ liệu của các mục sẽ được lưu trữ trong mảng, theo sau là hai dấu ngoặc vuông và tên của mảng. Đây là cú pháp trông như thế nào. data_type[][] array_name; Hãy xem một ví dụ mã.