1. 变量和数组要定义!!!
2. 要写 Implicit None
3. 要知道,你学的是Fortran,它是一门向量化的语言。如果按照你的写法,还不如学C语言。
[Fortran] 纯文本查看 复制代码 program he
Implicit None
Real :: a(4,5),suma,average
integer :: i
a = reshape([2,5,12,7,6,-1,0,6,4,3,4,-9,9,8,10,5,-13,7,2,3],shape(a))
suma=sum(a)
average=suma/size(a)
where( a<average) a = 0
do i = 1 , size(a,2)
write(*,*) a(:,i)
end do
end program he |