Basic Pascal Tutorial/Chapter 2/Solution/bg
Deutsch · English · Français · Български · 中文(中国) · 日本語
Решение на задача 2
(author: Tao Yue, state: unchanged)
(* Автор: Tao Yue
Дата: 19 Юни 1997
Описание:
Сума и средно аритметично на 5 зададени числа
Version:
1.0 - оригинална версия
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.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.