PROGRAM MAIN !DECLARATION INTEGER :: myArray(5) ! This creates a one-dimensional integer array with 5 elements. !INITIALIZATION myArray(1) = 10 myArray(2) = 20 myArray(3) = 30 myArray(4) = 40 myArray(5) = 50 ! Accessing and printing array elements using subscripts: !PRINT *, myArray(1) ! This will print the value 10. !PRINT *, myArray(3) ! This will print the value 40. print*, 'You are',myArray(5),'years old' END PROGRAM MAIN
To embed this project on your website, copy the following code and paste it into your website's HTML: