Sign in Join
Wiki copytemporary

Basic Pascal Tutorial/Chapter 1/Solution/zh CN: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Basic Pascal Tutorial/Chapter 1/Solution/zh CN

OldNewLine
1+1Ha - 参考答案 (原作者: Tao Yue, 状态: 未更改)
2+
3+在45、68、2、34,这5个整数中,求出它们的平均值、总和。
4+
5+参考答案:
6+
7+``` pascal
8+(* Author: Tao Yue
9+ Date: 19 June 1997
10+ Description:
11+ Find the sum and average of five predefined numbers
12+ Version:
13+ 1.0 - original version
14+*)
15+
16+program SumAverage;
17+
18+const
19+ NumberOfIntegers = 5;
20+
21+var
22+ A, B, C, D, E : integer;
23+ Sum : integer;
24+ Average : real;
25+
26+begin (* Main *)
27+ A := 45;
28+ B := 7;
29+ C := 68;
30+ D := 2;
31+ E := 34;
32+ Sum := A + B + C + D + E;
33+ Average := Sum / NumberOfIntegers;
34+ writeln ('Number of integers = ', NumberOfIntegers);
35+ writeln ('Number1 = ', A);
36+ writeln ('Number2 = ', B);
37+ writeln ('Number3 = ', C);
38+ writeln ('Number4 = ', D);
39+ writeln ('Number5 = ', E);
40+ writeln ('Sum = ', Sum);
41+ writeln ('Average = ', Average)
42+end. (* Main *)
43+```
44+
45+| | | |
46+|----|----|----|
47+| [[Basic Pascal Tutorial/Chapter 1/Programming Assignment/zh CN|上一页]] | [[Basic Pascal Tutorial/Contents/zh CN|目录]] | [[Basic Pascal Tutorial/Chapter 2/Input/zh CN|下一页]] |
48+
49+---
50+*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](/wiki-contact).*
51+Category: zh

Back to history