Below is code that will perform the task you have specified:
+++++++++++++++++++++++++++++
PROGRAM Successive_Sum;
Uses Crt;
Var sum, value, tmp : INTEGER;
avg : SINGLE;
BEGIN
ClrScr;
Writeln('Program to find the sum of 0, 1, 2, 3, ...');
Writeln;
Write('Enter stop value ');
Readln(value);
Writeln;
sum := 0;
For tmp := 0 to value Do
sum := sum + tmp;
Writeln('The sum from 0 to ', value, ' is ', sum);
avg := sum/value;
Writeln('The mean average is ', avg:3:2);
Writeln;
Writeln('Press RETURN to end this program');
Readln();
END.
+++++++++++++++++++++++++++++
If you're interested in learning PASCAL, you should download this
PDF book:
"The Turbo Pascal Tutor" 2nd Edition (1986)
https://archive.org/details/bitsavers_borlandturersion2.01986_16488828
(about 16 Mb)
You might also download the manuals for the version of Turbo Pascal you
are using, specifically:
the Users Guide,
Language Guide, and
Programmers Guide
- which can also be found at
www.archive.org/
David
---
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus