Var a,b,c,s,k,i:integer;
begin
write('b = ');readln(b);
write('c = ');readln(c);
write('a = ');readln(a);
s:=0; k:=0;
for i:=b to c do
if i mod a = 0
then begin s:=s+i; k:=k+1; end;
writeln('s = ',s,' k = ',k);
end.
Пример:
b = 4
c = 25
a = 5
s = 75 k = 5