二级FORTRAN程序设计上机题4计算机二级考试
文章作者 100test 发表时间 2009:04:10 01:59:50
来源 100Test.Com百考试题网
=============================================================================== 
试题说明 : 
=============================================================================== 
补充编制fortran77程序prog1.for,给定4×3的矩阵a与3×4 
的矩阵b(程序中为二维数组a与b),计算并输出乘积矩阵c=ab的 
对角线上各非零元素绝对值的自然对数之和。 
请编写该程序,最后运行程序。 其中部分程序与输出子程序 
writedat在程序中已经给出,不得修改。 
=============================================================================== 
程序 : 
=============================================================================== 
dimension a(4,3),b(3,4) 
data a/3.5,4.5,5.5,2.5,1.5,2.5,-6.5,1.5,-2.5,3.0,3.5,2.5/ 
data b/4.5,7.0,-1.5,-3.0,0.0,4.5,1.5,-3.5,0.5,2.5,4.5,-5.5/ 
write(*,100) s 
100 format(1x, s= ,e12.4) 
write(*,*) 
call writedat(s) 
end 
subroutine writedat(s) 
open(10,file= bc04.out ,status= new ) 
write(10,100) s 
100 format(1x,e12.4) 
end 
=============================================================================== 
所需数据 : 
=============================================================================== 
@3 $bc04.out 001 
|.6602e 01 
#e