DATAFILE

 !Program name: DATAFILE

Integer, dimension (:,:), allocatable :: a

integer :: i, j, c, l

Print *, 'Give the number of columns of the matrix a: '

Read *, c

Print *, 'Give the number of lines of the matrix a: '

Read *, l

Allocate (a(c,l))

!Generate the scalar data of the matrix a

do i=1, c

   do j= 1, l

      a(i,j)= i*j

   end do

end do

 

!create data1.dat (replace if it already exists) and write the a(i,j)

 

open(1,file='data1.dat', status='replace')

do i=1, c

   do j=1, l

   write(1,*) a(i,j)

   end do

end do

close(1)

 

!Display the data recorded in data1.dat

 

do i=1, c

   do j=1, l

   write(*,*), a(i,j)

   end do

end do

Deallocate(a)

stop

end

Comentários

Postagens mais visitadas deste blog

HYDROGEN-RADIAL

HYDROGEN-POTENTIAL

ONE_PART_QHO