--- gfortran 6.3 ---
program prog1
integer N, k, i, j
real a(10,10)
read *, N
print *, 'Матрица:'
do i = 1,N
do j = 1,N
a(i,j) = sin(1.0*i+1.0*j/2)
end do
end do
do i = 1, N
print *, (a(i,j), j=1,N)
end do
k = 0
do i = 1, N
do j = 1, N
if(a(i, j) > 0) k = k+1
end do
end do
print *, k
end
Результат:
4
Матрица:
0.997494996 0.909297407 0.598472118 0.141120002
0.598472118 0.141120002 -0.350783229 -0.756802499
-0.350783229 -0.756802499 -0.977530122 -0.958924294
-0.977530122 -0.958924294 -0.705540299 -0.279415488
6