Basic Pascal Tutorial/Chapter 2/Programming Assignment: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | 2F - Programming Assignment (author: Tao Yue, state: unchanged) | |
| 2 | 2 | ||
| 3 | 3 | Again find the sum and average of five numbers, but this time read in five integers and display the output in neat columns. | |
| 4 | 4 | ||
| 5 | 5 | Refer to the original problem specification if needed. You should type in the numbers separated by spaces from the keyboard: `45 7 68 2 34`. | |
| 6 | 6 | ||
| 7 | 7 | The output should now look like this: | |
| 8 | 8 | ||
| 9 | - | ||
| 9 | + | ``` | |
| 10 | + | Number of integers = 5 | |
| 10 | 11 | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 12 | + | Number1: 45 | |
| 13 | + | Number2: 7 | |
| 14 | + | Number3: 68 | |
| 15 | + | Number4: 2 | |
| 16 | + | Number5: 34 | |
| 17 | + | ================ | |
| 18 | + | Sum: 156 | |
| 19 | + | Average: 31.2 | |
| 20 | + | ``` | |
| 19 | 21 | ||
| 20 | 22 | As an added exercise, you can try to write the output to a file. However, I won't use files in the problem solution. | |
| 21 | 23 | ||
| 22 | 24 | --- | |
| 23 | 25 | *From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 2/Programming Assignment", 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).* |
