Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Exercicio 1
!gfortran, gcc version 7.4.0 Program Exercicio1 implicit none integer, parameter :: m=4 real (8) :: mat(m,m+1) integer :: i mat = reshape((/9.d0,2.d0,-3.d0,-2.d0,-2.d0,8.d0,2.d0,3.d0,3.d0,-2.d0,11.,2.,2.,3.,-4.,10.,54.4,-14.,12.5,-21./), shape(mat)) print*, "Matriz original" print*, " " do i = 1, m write (*, '(5f12.4)') mat(i, :) end do call GJ (m,m+1,mat) CONTAINS subroutine GJ(m,n,a) implicit none integer :: m, n ! Dimensões da matriz real(8) :: a(m,n) ! matriz passada do programa principal para a subrotina integer :: i,j,k do i=1,m mat(i, i:n) = mat(i,i:n)/ mat(i,i) do j=1,m if (i/=j) then do k=n,i,-1 mat(j,k)= mat(j,k) - (mat(i,k) * mat(j,i)) end do end if end do end do print*, " " print*, "Matriz diagonalizada" print*, " " do i = 1, m write (*, '(5f12.4)') mat(i, :) end do return end subroutine GJ end program Exercicio1
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
SIUM(3.7)
55
finitos
Sum of series
Won rules summation 1 to 100 square namber
Sum 1 to 99 divided by 12 to 100
Jánošík 2018
Blasius Euler Code
hello world
Dynamical Memory Allocation fortran
Please log in to post a comment.