Fortran · 282 bytes Raw Blame History
1 ! CHECK: 55
2 program test_allocatable
3 implicit none
4 integer, allocatable :: a(:)
5 integer :: i, s
6
7 allocate(a(10))
8
9 do i = 1, 10
10 a(i) = i
11 end do
12
13 s = 0
14 do i = 1, 10
15 s = s + a(i)
16 end do
17
18 print *, s
19
20 deallocate(a)
21 end program
22