annotate src/euler6.f @ 0:307a81e46071 tip

initial committ
author Robert McIntyre <rlm@mit.edu>
date Tue, 18 Oct 2011 01:17:49 -0700
parents
children
rev   line source
rlm@0 1 program euler6
rlm@0 2
rlm@0 3 implicit none
rlm@0 4 character (len = 100) :: file_name
rlm@0 5 integer, parameter :: big = selected_int_kind(11)
rlm@0 6 integer (kind = big) :: n,ans
rlm@0 7 call getarg( 1, file_name )
rlm@0 8 OPEN(unit = 7, file = file_name)
rlm@0 9 read (7,*) n
rlm@0 10
rlm@0 11 ans = ((n * (n + 1))/2)**2 - ((n * (n + 1) * (1 + ( 2 * n)))/6)
rlm@0 12
rlm@0 13 write (unit = *, fmt = "(I0)") ans
rlm@0 14
rlm@0 15
rlm@0 16
rlm@0 17
rlm@0 18 end program euler6