Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Program arrayProg

program arrayProg
   
   real :: numbers(5) !One dimension integer array
   integer :: matrix(3,3), i, j !two dimwnsional real array
   
   !assing some values to the array numbers
   do i=1, 5
        numbers(i) = i * 2.0
   end do
   
   !Display the values
   do i=1, 3
        Print *, numbers(i)
   end do
   
   !Assing some values to the array matrix
   do i=1, 3
        do j=1, 3
            matrix(i,j) = i+j
        end do
   end do
   
   !Display the values
   do i=1, 3
        do j=1, 3
            Print *, matrix(i,j)
        end do
   end do
   
   !Short hand assignment
   numbers = (/1.5, 3.2, 4.5, 0.9, 7.2/)
   
   !Display the values
   do i=1, 5
        Print *, numbers(i)
   end do
   
end program arrayProg

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.