BLOCO DE DECLARACOES DE VARIAVEIS
Fortran
program array
!Bloco de Declaração de Variáveis!
Implicit none
integer(4)::DIM,i,j
Real(8),allocatable::u(:),v(:), A(:,:),B(:,:), PROD_ESC_uv(:), PROD_VEC_uv(:)
!Leitura do arquivo de entrada!
Read(*,*)DIM
Read(*,*) !Blank!
allocate(u(DIM),v(DIM));u=0.0;v=0.0
read(*,*)(u(i),i=1,DIM)
read(*,*)(v(i),i=1,DIM)
!IMPRIMIR u,v!
write(*,*)u
write(*,*)v
read(*,*)!BLANK
allocate(A(DIM,DIM),B(dim,dim))
A=0.0 ; B=0.0
DO i=1, dim
read(*,*) (A(i,j),j=1,dim)
END DO
write(*,*)A(2,2)
read(*,*)!blank
DO I=1,DIM
read(*,*) (B(i,j),j=1,dim)
END DO
write(*,*)B(1,2)
!BLOCO DE OPERAÇÕES
!CÓDIGO DO PRODUTO ESCALAR!
PROD_ESC_uv=0.0
DO i=1,DIM
PROD_ESC_uv = PROD_ESC_uv+u(i)*v(i)
END DO
write(*,*) PROD_ESC_uv
!CÓDIGO DO PRODUTO VETORIAL!
ALLOCATE (PROD_VEC_uv(DIM))
PROD_VEC_uv=0.0
end program array
Output
Embed on website
To embed this program on your website, copy the following code and paste it into your website's HTML:
Comments
This comment belongs to a banned user and is only visible to admins.
This comment belongs to a deleted user and is only visible to admins.