需求
“Pseudocode that reads a 10 by 15 matrix A and a 15 by 25 matrix B, checks that their dimensions match, initializes a 10 by 25 matrix C, loops through i, j and k to sum products, outputs C, or reports a dimension mismatch.”
接著試試Change the matrix sizes to 3 by 4 and 4 by 2.Add a step to print each completed row.
這張圖裡有什麼
看懂背後的決策。
01
Check inner dimensions match (15 == 15); if not, error.
02
Initialize result matrix.
03
Use three nested loops for rows (i), columns (j), and inner dimension (k).
This flowchart can be adapted for any matrix multiplication where the inner dimensions agree.