Advertisement
zrhans

matriz-3x3.f95

Oct 16th, 2014
929
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     program matriz_3x3
  2.     ! Matriz
  3.     !
  4.     !     | 3 -7 4 |   | a11 a12 a13 |   | A(1,1) A(1,2) A(1,3) |
  5.     ! A = | 0  1 5 | = | a21 a22 a23 | = | A(2,1) A(2,2) A(2,3) |
  6.     !     | 4  2 2 |   | a31 a32 a33 |   | A(3,1) A(3,2) A(3,3) |
  7.     !
  8.      
  9.     integer A(3,3)
  10.      
  11.     data A /3,0,4,-7,1,2,4,5,2/
  12.     print *," Matriz A "
  13.     print *,"=========="
  14.     print 100, ((A(i,j),j=1,3),i=1,3)
  15.      
  16.     100 format(3(i2,1X),/)
  17.      
  18.     101 format("A(",i1,",",i1,") = ",i2)
  19.      
  20.     ! Imprimindo elemento por elemento
  21.     print *,"_______________________"
  22.     print *," Elementos da Matriz A "
  23.     print *,"-----------------------"
  24.     do i=1,3
  25.       do j=1,3
  26.         print 101,i,j,A(i,j)
  27.       enddo
  28.     enddo
  29.      
  30.     stop '>>> Programa finalizado!'
  31.     end program matriz_3x3
Advertisement
RAW Paste Data Copied
Advertisement