2d interger array
Sure! Here's an example of a 2D integer array in Fortran:
program twoDArray
implicit none
integer, parameter :: rows = 3
integer, parameter :: columns = 4
integer :: i, j
integer :: myArray(rows, columns)
! Initialize the array
do i = 1, rows
do j = 1, columns
myArray(i, j) = i + j
end do
end do
! Print the array
do i = 1, rows
do j = 1, columns
write(, ) myArray(i, j)
end do
end do
end program twoDArray
This program declares a 2D integer array called myArray
with rows
rows and columns
columns. It then initializes the array by assigning values to each element using nested do-loops. Finally, it prints the values of the array using another set of nested do-loops.