fortran语言问题DIMENSION M(4,3)DATA M/1,3,2,4,5,7,6,8,9,10,11,12/K=3WRITE(*,100)(M(K,1).I=1,3)100 FORMAT(1X,3I5)END求程序运行结果,并解释每一步的意思,

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/14 14:53:12
fortran语言问题DIMENSIONM(4,3)DATAM/1,3,2,4,5,7,6,8,9,10,11,12/K=3WRITE(*,100)(M(K,1).I=1,3)100FORMAT(1X

fortran语言问题DIMENSION M(4,3)DATA M/1,3,2,4,5,7,6,8,9,10,11,12/K=3WRITE(*,100)(M(K,1).I=1,3)100 FORMAT(1X,3I5)END求程序运行结果,并解释每一步的意思,
fortran语言问题
DIMENSION M(4,3)
DATA M/1,3,2,4,5,7,6,8,9,10,11,12/
K=3
WRITE(*,100)(M(K,1).I=1,3)
100 FORMAT(1X,3I5)
END
求程序运行结果,并解释每一步的意思,

fortran语言问题DIMENSION M(4,3)DATA M/1,3,2,4,5,7,6,8,9,10,11,12/K=3WRITE(*,100)(M(K,1).I=1,3)100 FORMAT(1X,3I5)END求程序运行结果,并解释每一步的意思,
WRITE(*,100)(M(K,1).I=1,3)这一行,打错了,要把点改成逗号
WRITE(*,100)(M(K,1),I=1,3)
程序运行结果:
2 2 2
DIMENSION M(4,3)
!定义数组M维数为4*3
DATA M/1,3,2,4,5,7,6,8,9,10,11,12/
!给M赋值,注意是按列依次赋值,即
M = [1 5 9
3 7 10
2 6 11
4 8 12]
K=3
!定义K并赋值3
WRITE(*,100)(M(K,1),I=1,3)
!打印出M(3,1),重复三次
100 FORMAT(1X,3I5)
!定义格式为整数格式,长度为5
END
!结束程序