程序描述
以Z形式打印平方矩阵的元素
一个方阵是行数和列数相同的矩阵。一个n×n的矩阵被称为n阶方阵
算法

To print the elements of the Square Matrix in Z form We need to print the first row of matrix then diagonal and then last row of the square matrix.
Example
的中文翻译为:
示例
/* Program to print a square matrix in Z form */
#include<stdio.h>
int main(){
int rows, cols, r, c, matrix[10][10];
clrscr(); /*Clears the Screen*/
printf("Please enter the number of rows for the Square matrix: ");
scanf("%d", &rows);
printf("<p>");
printf("Please enter the number of columns for the Square matrix: ");
scanf("%d", &cols);
printf("</p>
<p>");
printf("Please enter the elements for the Matrix: </p>
<p>");
for(r = 0; r </p>
<p>");
for(r = 0; r =0;r++,c--){
printf("%d\t ", matrix[r][c]);
}
for (r = 1; r </p></stdio.h>
输出

13万字C语言保姆级教程(深入):立即使用
在学习笔记中,你将探索c语言的核心概念和高级技巧!











