Mercurial > coderloop
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/euler6.f Tue Oct 18 01:17:49 2011 -0700 1.3 @@ -0,0 +1,18 @@ 1.4 + program euler6 1.5 + 1.6 + implicit none 1.7 + character (len = 100) :: file_name 1.8 + integer, parameter :: big = selected_int_kind(11) 1.9 + integer (kind = big) :: n,ans 1.10 + call getarg( 1, file_name ) 1.11 + OPEN(unit = 7, file = file_name) 1.12 + read (7,*) n 1.13 + 1.14 + ans = ((n * (n + 1))/2)**2 - ((n * (n + 1) * (1 + ( 2 * n)))/6) 1.15 + 1.16 + write (unit = *, fmt = "(I0)") ans 1.17 + 1.18 + 1.19 + 1.20 + 1.21 + end program euler6