Basic Pascal Tutorial/Chapter 2/Solution/bg: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Basic Pascal Tutorial/Chapter 2/Solution/bg
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## Решение на задача 2 | |
| 2 | + | ||
| 3 | + | *(author: Tao Yue, state: unchanged)* | |
| 4 | + | ||
| 5 | + | ``` pascal | |
| 6 | + | (* Автор: Tao Yue | |
| 7 | + | Дата: 19 Юни 1997 | |
| 8 | + | Описание: | |
| 9 | + | Сума и средно аритметично на 5 зададени числа | |
| 10 | + | Version: | |
| 11 | + | 1.0 - оригинална версия | |
| 12 | + | 2.0 - read in data from keyboard | |
| 13 | + | *) | |
| 14 | + | ||
| 15 | + | program SumAverage; | |
| 16 | + | ||
| 17 | + | const | |
| 18 | + | NumberOfIntegers = 5; | |
| 19 | + | ||
| 20 | + | var | |
| 21 | + | A, B, C, D, E : integer; | |
| 22 | + | Sum : integer; | |
| 23 | + | Average : real; | |
| 24 | + | ||
| 25 | + | begin (* Main *) | |
| 26 | + | write ('Enter the first number: '); | |
| 27 | + | readln (A); | |
| 28 | + | write ('Enter the second number: '); | |
| 29 | + | readln (B); | |
| 30 | + | write ('Enter the third number: '); | |
| 31 | + | readln (C); | |
| 32 | + | write ('Enter the fourth number: '); | |
| 33 | + | readln (D); | |
| 34 | + | write ('Enter the fifth number: '); | |
| 35 | + | readln (E); | |
| 36 | + | Sum := A + B + C + D + E; | |
| 37 | + | Average := Sum / 5; | |
| 38 | + | writeln ('Number of integers = ', NumberOfIntegers); | |
| 39 | + | writeln; | |
| 40 | + | writeln ('Number1:', A:8); | |
| 41 | + | writeln ('Number2:', B:8); | |
| 42 | + | writeln ('Number3:', C:8); | |
| 43 | + | writeln ('Number4:', D:8); | |
| 44 | + | writeln ('Number5:', E:8); | |
| 45 | + | writeln ('================'); | |
| 46 | + | writeln ('Sum:', Sum:12); | |
| 47 | + | writeln ('Average:', Average:10:1); | |
| 48 | + | end. | |
| 49 | + | ``` | |
| 50 | + | ||
| 51 | + | --- | |
| 52 | + | *From the Free Pascal wiki, page "Basic Pascal Tutorial/Chapter 2/Solution/bg", 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).* |
