Difference between revisions of "Basic Pascal Tutorial/Chapter 2/Solution/ja"

From Free Pascal wiki
Jump to navigationJump to search
(Created page with "{{Solution 2}} 2Fa - Solution (author: Tao Yue, state: unchanged) <syntaxhighlight> (* Author: Tao Yue Date: 19 June 1997 Description: Find the sum and av...")
 
Line 1: Line 1:
 
{{Solution 2}}
 
{{Solution 2}}
  
2Fa - Solution (author: Tao Yue, state: unchanged)
+
2Fa - 解答例 (著者: Tao Yue, 状態: 原文のまま修正なし)
 
<syntaxhighlight>
 
<syntaxhighlight>
 
(* Author:    Tao Yue
 
(* Author:    Tao Yue
 
   Date:      19 June 1997
 
   Date:      19 June 1997
   Description:
+
   記述:
       Find the sum and average of five predefined numbers
+
       5つのあらかじめ定義された数字の合計と平均を求める。
 
   Version:
 
   Version:
 
       1.0 - original version
 
       1.0 - original version
Line 48: Line 48:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
{|style=color-backgroud="white" cellspacing="20"
 
{|style=color-backgroud="white" cellspacing="20"
|[[Programming_Assignment_2|previous]]   
+
|[[Programming_Assignment_2/ja|previous]]   
|[[Contents|contents]]  
+
|[[Contents/ja|contents]]  
|[[Sequential_control|next]]
+
|[[Sequential_control/ja|next]]
 
|}
 
|}

Revision as of 19:59, 8 August 2015

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

2Fa - 解答例 (著者: Tao Yue, 状態: 原文のまま修正なし)

(* Author:    Tao Yue
   Date:      19 June 1997
   記述:
      5つのあらかじめ定義された数字の合計と平均を求める。
   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.
previous contents next