Lab6_A

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
program Lab6_A;
var a, x, n, s, s_a, s_f: real;
begin
writeln('vvedit N: ');
readln(n);
s := 0;
x := 0;
s_f := n * (n + 1) / 2;
while n > 0 do begin
s := s + n;
n := n - 1;
x := x + 1;
end;
s_a := s / x;
writeln('Summa riady: ',s);
writeln('Seredne ariphmetichne: ',s_a);
writeln('Summa obchislena za formuloyou: ', s_f);
end.