view 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
line wrap: on
line source
1 program euler6
3 implicit none
4 character (len = 100) :: file_name
5 integer, parameter :: big = selected_int_kind(11)
6 integer (kind = big) :: n,ans
7 call getarg( 1, file_name )
8 OPEN(unit = 7, file = file_name)
9 read (7,*) n
11 ans = ((n * (n + 1))/2)**2 - ((n * (n + 1) * (1 + ( 2 * n)))/6)
13 write (unit = *, fmt = "(I0)") ans
18 end program euler6