Difference between revisions of "Solution 2/zh CN"

From Lazarus wiki
(Created page with "2Fa - 参考答案 (原作者: Tao Yue, 状态: 未更改) <syntaxhighlight> (* Author: Tao Yue Date: 19 June 1997 Description: Find the sum and average o...")
 
Line 50: Line 50:
 
|[[Programming_Assignment_2/zh_CN|上一页]]
 
|[[Programming_Assignment_2/zh_CN|上一页]]
 
|[[Contents/zh_CN|目录]]
 
|[[Contents/zh_CN|目录]]
|[[Sequential_control|下一页]]
+
|[[Sequential_control/zh_CN|下一页]]
 
|}
 
|}
  
 
[[Category:zh]]
 
[[Category:zh]]

Revision as of 09:46, 5 December 2013

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

(* Author:    Tao Yue
   Date:      19 June 1997
   Description:
      Find the sum and average of five predefined numbers
   Version:
      1.0 - original version
      2.0 - read in data from keyboard
*)

program SumAverage;

const
   NumberOfIntegers = 5;

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

begin    (* Main *)
   write ('Enter the first number: ');
   readln (A);
   write ('Enter the second number: ');
   readln (B);
   write ('Enter the third number: ');
   readln (C);
   write ('Enter the fourth number: ');
   readln (D);
   write ('Enter the fifth number: ');
   readln (E);
   Sum := A + B + C + D + E;
   Average := Sum / 5;
   writeln ('Number of integers = ', NumberOfIntegers);
   writeln;
   writeln ('Number1:', A:8);
   writeln ('Number2:', B:8);
   writeln ('Number3:', C:8);
   writeln ('Number4:', D:8);
   writeln ('Number5:', E:8);
   writeln ('================');
   writeln ('Sum:', Sum:12);
   writeln ('Average:', Average:10:1);
end.
上一页 目录 下一页