In modern Fortran you don't need a loop either. The code to compute the norm of a vector of a billion integers starting with zero is
program main
implicit none
integer , parameter :: n = 10**9
double precision, allocatable :: x(:)
integer :: i
allocate (x(n))
forall (i=1:n) x(i) = dble(i-1)
print*,sqrt(sum(x**2))
end program main
"The result of NORM2 (X) has a value equal to a processor-dependent approximation to the generalized L2 norm of X, which is the square root of the sum of the squares of the elements of X. If X has size zero, the result has the value zero."