Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program random_matrix
- implicit none
- real, allocatable:: A(:,:) ! matrix for which the determinant is calculated
- integer n ! size of the matrix A nxn
- integer i,j ! loop indexes
- real r ! random number
- ! Typing in the size of the matrix and amount of 0
- !**************************************************************************!
- write(*,*) 'amount of rows and colums'
- read(*,*) n
- allocate (A(n,n))
- ! Creating the matrix of random numbers
- !**************************************************************************!
- do i=1,n
- do j=1,n
- r=rand()
- A(i,j)=floor((r*10.0)+1)
- enddo
- enddo
- call print_matrix
- end program
- subroutine print_matrix
- implicit none
- integer n ! size of the matrix A nxn
- real, allocatable:: A(:,:)
- integer :: i,j
- do i = 1, n
- write (*,10) (A(i,j), j = 1, n)
- 10 format (6i3)
- end do
- end subroutine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement