Advertisement
Guest User

Untitled

a guest
Jan 7th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program random_matrix
  2. implicit none
  3.  
  4.  
  5. real, allocatable:: A(:,:)          ! matrix for which the determinant is calculated
  6. integer             n               ! size of the matrix A nxn
  7. integer             i,j             ! loop indexes
  8. real                r               ! random number
  9.  
  10. ! Typing in the size of the matrix and amount of 0
  11. !**************************************************************************!
  12. write(*,*)  'amount of rows and colums'
  13. read(*,*)   n
  14. allocate (A(n,n))
  15.  
  16. ! Creating the matrix of random numbers
  17. !**************************************************************************!
  18.  
  19. do i=1,n
  20.     do j=1,n
  21.         r=rand(1)
  22.     A(i,j)=floor((r*10.0)+1)
  23.     enddo  
  24. enddo
  25. write (*,*) A(i,j)
  26.  
  27.  
  28. end program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement