Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program zadatak_3
- real:: suma_x = 0, suma_y = 0
- !prethodno moze da se napise i kao real suma_x,suma_y
- !suma_x = 0
- !suma_y = 0
- dimension a(100,100)
- print *, "Uneti dimenzije matrice: "
- read *,n
- print *, "Uneti elemente matrice:"
- read(*,*) ((a(i,j),j=1,n),i=1,n)
- result = 0
- call fun(a,n,result)
- print *, result
- end
- subroutine fun(a,n, result)
- dimension a(100,100)
- suma_x = a(1,1) + a(1,n) + a(n,1) + a(n,n)
- suma_y = 0
- do i=1,n
- do j=1,n
- if(i .eq. 1 .or. i .eq. n) then
- suma_y = suma_y + a(i,j)
- endif
- end do
- end do
- suma_y = suma_y - suma_x
- result = suma_x * suma_y
- !print *, suma_x
- !print *, suma_y
- return
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement