Difference between revisions of "Basic Pascal Tutorial/Chapter 1/Solution/zh CN"

From Free Pascal wiki
Jump to navigationJump to search
(Use pascal highlighter)
(bypass [previously missed] redirect [cf. discussion])
(2 intermediate revisions by the same user not shown)
Line 46: Line 46:
  
 
{|style=color-backgroud="white" cellspacing="20"
 
{|style=color-backgroud="white" cellspacing="20"
|[[Programming_Assignment/zh_CN|上一页]]
+
|[[Basic Pascal Tutorial/Chapter 1/Programming Assignment/zh_CN|上一页]]
|[[Contents/zh_CN|目录]]
+
|[[Basic Pascal Tutorial/Contents/zh CN|目录]]
|[[Input/zh_CN|下一页]]
+
|[[Basic Pascal Tutorial/Chapter 2/Input/zh_CN|下一页]]
 
|}
 
|}
  
 
[[Category:zh]]
 
[[Category:zh]]

Revision as of 14:37, 6 August 2022

български (bg) Deutsch (de) English (en) français (fr) 日本語 (ja) 한국어 (ko) русский (ru) 中文(中国大陆)‎ (zh_CN)

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

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

参考答案:

(* 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 *)
上一页 目录 下一页