Mercurial > coderloop
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:307a81e46071 |
---|---|
1 program euler6 | |
2 | |
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 | |
10 | |
11 ans = ((n * (n + 1))/2)**2 - ((n * (n + 1) * (1 + ( 2 * n)))/6) | |
12 | |
13 write (unit = *, fmt = "(I0)") ans | |
14 | |
15 | |
16 | |
17 | |
18 end program euler6 |