print array in fortran
To print an array in Fortran, you can use the WRITE
statement. Here's an example:
program print_array
implicit none
integer :: i
real :: array(5) = [1.0, 2.0, 3.0, 4.0, 5.0]
do i = 1, size(array)
write(,) array(i)
end do
end program print_array
In this example, we have an array array
of size 5 with some values. The WRITE
statement is used to print each element of the array on a new line. The in
write(,*)
indicates that the output should be written to the standard output.
Please note that the above code is just an example, and you can modify it according to your specific requirements.