Difference between revisions of "Basic Pascal Tutorial/Chapter 2/Solution"
From Lazarus wiki
Jump to navigationJump to search (New page: 2Fa - Solution <font color="#000000"> 1:</font> <font color="#cc0000">(*</font><font color="#cc0000"> </font><font color="#cc0000">Author:</font><font color="#cc0000"> </font><font colo...) |
|||
Line 1: | Line 1: | ||
− | 2Fa - Solution | + | 2Fa - Solution (author: Tao Yue, state: unchanged) |
<font color="#000000"> 1:</font> <font color="#cc0000">(*</font><font color="#cc0000"> </font><font color="#cc0000">Author:</font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000">Tao</font><font color="#cc0000"> </font><font color="#cc0000">Yue</font> | <font color="#000000"> 1:</font> <font color="#cc0000">(*</font><font color="#cc0000"> </font><font color="#cc0000">Author:</font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000">Tao</font><font color="#cc0000"> </font><font color="#cc0000">Yue</font> | ||
<font color="#000000"> 2:</font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000">Date:</font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000">19</font><font color="#cc0000"> </font><font color="#cc0000">June</font><font color="#cc0000"> </font><font color="#cc0000">1997</font> | <font color="#000000"> 2:</font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000">Date:</font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000"> </font><font color="#cc0000">19</font><font color="#cc0000"> </font><font color="#cc0000">June</font><font color="#cc0000"> </font><font color="#cc0000">1997</font> |
Revision as of 21:36, 25 November 2007
2Fa - Solution (author: Tao Yue, state: unchanged)
1: (* Author: Tao Yue 2: Date: 19 June 1997 3: Description: 4: Find the sum and average of five predefined numbers 5: Version: 6: 1.0 - original version 7: 2.0 - read in data from keyboard 8: *) 9: 10: program SumAverage; 11: 12: const 13: NumberOfIntegers = 5; 14: 15: var 16: A, B, C, D, E : integer; 17: Sum : integer; 18: Average : real; 19: 20: begin (* Main *) 21: write ('Enter the first number: '); 22: readln (A); 23: write ('Enter the second number: '); 24: readln (B); 25: write ('Enter the third number: '); 26: readln (C); 27: write ('Enter the fourth number: '); 28: readln (D); 29: write ('Enter the fifth number: '); 30: readln (E); 31: Sum := A + B + C + D + E; 32: Average := Sum / 5; 33: writeln ('Number of integers = ', NumberOfIntegers); 34: writeln; 35: writeln ('Number1:', A:8); 36: writeln ('Number2:', B:8); 37: writeln ('Number3:', C:8); 38: writeln ('Number4:', D:8); 39: writeln ('Number5:', D:8); 40: writeln ('================'); 41: writeln ('Sum:', Sum:12); 42: writeln ('Average:', Average:10:1); 43: end.
previous | contents | next |