fork download
  1. program sliceArray
  2. integer, dimension(10,10) :: theArray
  3. integer :: i, j
  4.  
  5. theArray = 0
  6. theArray(3:7,3:7) = 1
  7.  
  8. do i = 3,7
  9. do j = 3,7
  10. theArray(i,j) = j
  11. end do
  12. end do
  13.  
  14.  
  15. do i = 1,10
  16. do j = 1,10
  17. write(*,"(I2)",advance="no") theArray(i,j)
  18. end do
  19. write(*,*)
  20. end do
  21.  
  22. print *, theArray((/3,4,5/), :)
  23. end
  24.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 3 4 5 6 7 0 0 0
 0 0 3 4 5 6 7 0 0 0
 0 0 3 4 5 6 7 0 0 0
 0 0 3 4 5 6 7 0 0 0
 0 0 3 4 5 6 7 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
           0           0           0           0           0           0           3           3           3           4           4           4           5           5           5           6           6           6           7           7           7           0           0           0           0           0           0           0           0           0