Adding some strings and geometry algorithms to notebook.
[andmenj-acm.git] / PC^2 / pc2board / samps / sumit.pas
blobd0d123cec74005b1b77300fc0edd9f067d3a2240
5 * File: sum1.pas
6 * Purpose: prints the sum of the positive integers in sumit.dat
7 * Author: pc2@ecs.csus.edu or http://www.ecs.csus.edu/pc2
9 * $Id: sumit.pas,v 1.1 2005/03/06 05:13:57 laned Exp $
13 var
14 tf : text;
15 i : integer;
16 sum : integer;
18 begin
19 assign (tf,'sumit.dat');
20 {$i-} reset (tf); {$i+}
21 if ioresult <> 0 then
22 writeln('could not open file sumit.dat ')
23 else
24 begin
26 sum := 0;
27 while not eof (tf) do
28 begin
29 readln(tf,i);
30 if (i > 0) then
31 sum := sum + i;
32 end;
34 writeln('The sum of the positive integers is ',sum);
35 end;
37 end.
38 { EOF }