Найти сумму логарифмов всех целых чисел кратных 6 из отрезка [A;B] — Pascal(Паскаль)

Var A,B,i:integer;
s:double;
begin
writeln('vvedite konci intervala [A,B]');
readln(A,B);
s:=0;
for i:=A to B do
begin
if i mod 6=0 then
s:=s+ln(i);
else continue
end;
writeln('s=', s:6:3)
end.

Вариант 2

Var A,B,j:integer;
s:real;
function summa(i:integer):real;
begin
summa:=ln(i)
end;
begin
writeln('enter A and B');
readln(A,B);
s:=0;
for j:=A to B do
begin
if j mod 6=0 then
s:=s+summa(j);
else continue
end;
writeln('s=', s:6:3)
end.

Leave a Comment

54 − 44 =