Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 1/Solution/zh CN

한국어 · Deutsch · English · Français · Български · Русский · 中文(中国) · 日本語

1Ha - 参考答案 (原作者: Tao Yue, 状态: 未更改)

在45、68、2、34,这5个整数中,求出它们的平均值、总和。

参考答案:

pascal
(* Author:    Tao Yue
   Date:      19 June 1997
   Description:
      Find the sum and average of five predefined numbers
   Version:
      1.0 - original version
*)

program SumAverage;

const
   NumberOfIntegers = 5;

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

begin    (* Main *)
   A := 45;
   B := 7;
   C := 68;
   D := 2;
   E := 34;
   Sum := A + B + C + D + E;
   Average := Sum / NumberOfIntegers;
   writeln ('Number of integers = ', NumberOfIntegers);
   writeln ('Number1 = ', A);
   writeln ('Number2 = ', B);
   writeln ('Number3 = ', C);
   writeln ('Number4 = ', D);
   writeln ('Number5 = ', E);
   writeln ('Sum = ', Sum);
   writeln ('Average = ', Average)
end.     (* Main *)
上一页 目录 下一页

From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 1/Solution/zh CN", 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.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 3 people, 2013–2022

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
WangyouworldCreated page
Wangyouworld
Wangyouworld
BartUse pascal highlighter
Kai BurghardtKai Burghardt moved page Solution/zh CN to Basic Pascal Tutorial/Chapter 1/Solution/zh CN: tidy up main name space: create subpage hierarchy for basic Pascal tutorial [cf. [[Special: PermaLink/1497... (minor)
Kai Burghardtbypass redirects [cf. discussion]
Kai Burghardtbypass [previously missed] redirect [cf. discussion]
Kai Burghardtbypass language bar/categorization template redirect [cf. discussion] (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.