Sign in Join
Wiki copytemporary

Revision 1 of 1, by Kai Burghardt on 8-20-2022. The page as it is now.

Basic Pascal Tutorial/Chapter 2/Solution/de

2Fa - Lösung

(Autor: Tao Yue, Übersetzung ins Deutsche)

pascal
(* Author:    Tao Yue
   Date:      19 June 1997
   Description:
      Ermittlung der Summe und des Durchschnitts von fünf vordefinierten Zahlen
   Version:
      1.0 - original version
      2.0 - Daten von der Tastatur einlesen
*)

program SumAverage;

const
   NumberOfIntegers = 5;

var
   A, B, C, D, E : integer;
   Sum : integer;
   Average : real;

begin    (* Main *)
   write ('Gib die erste Zahl ein: ');
   readln (A);
   write ('Gib die zweite Zahl ein: ');
   readln (B);
   write ('Gib die dritte Zahl ein: ');
   readln (C);
   write ('Gib die vierte Zahl ein: ');
   readln (D);
   write ('Gib die fünfte Zahl ein: ');
   readln (E);
   Sum := A + B + C + D + E;
   Average := Sum / 5;
   writeln ('Anzahl der Ganzzahlen = ', NumberOfIntegers);
   writeln;
   writeln ('Nummer1:', A:8);
   writeln ('Nummer2:', B:8);
   writeln ('Nummer3:', C:8);
   writeln ('Nummer4:', D:8);
   writeln ('Nummer5:', E:8);
   writeln ('================');
   writeln ('Summe:', Sum:12);
   writeln ('Durchschnitte:', Average:10:1);
end.

From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 2/Solution/de", as it stood on 2022-08-20 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.