矩阵转置
题目截图:

代码如下:
1 /*
2 矩阵转置
3 注意:输出格式
4 */
5
6 #include <stdio.h>
7 #include <string.h>
8 #include <math.h>
9 #include <stdlib.h>
10 #include <time.h>
11 #include <stdbool.h>
12
13 int Num[101][101] = {0};
14
15 int main() {
16 int i, j, N;
17 scanf("%d", &N); // 输入矩阵维数
18 for(i=0; i<N; ++i) { // 输入矩阵的转置形式
19 for(j=0; j<N; ++j) {
20 scanf("%d", &Num[j][i]);
21 }
22 }
23 for(i=0; i<N; ++i) { // 按格式输出
24 for(j=0; j<N; ++j) {
25 printf("%d", Num[i][j]);
26 if(j != N-1) {
27 printf(" ");
28 }
29 }
30 if(i != N-1) {
31 printf("\n");
32 }
33 }
34
35 return 0;
36 } 相关推荐
sdwylry 2020-02-20
mieleizhi0 2019-03-26
ainizhongguoaa 2019-05-05
rookieliang 2010-03-17
waiwaiLILI 2010-03-17
python0 2017-11-24
Haopython 2019-01-28
Pythonandme 2019-01-23
python0 2018-12-12
星辰大海的路上 2020-04-22
wklken的笔记 2020-01-11
吴小伟 2019-11-30
liusarazhang 2019-10-21
flymist 2017-02-03
Datawhale 2019-05-18
manongpengzai 2017-02-03
pengkunstone 2019-06-30
amazingbo 2019-06-28