program sada;
var k,n,res,i:integer;
temp:string;
begin
res:=0;
readln(k);
temp:='';
for i:=1 to n do
temp:=temp+'9';
n:=strtoint(temp);
for i:=1 to n do begin
if (i mod k = 0) then res:=res+i;
end;
writeln(res);
end.
p.s. Программа написана на pascalABC
var
k, n, Summ, i, max, min:integer;
write('n = '); readln(n);
write('k = '); readln(k);
max := 9;
min := 1;
for i := 2 to n do
max := max * 10 + 9;
min := min * 10;
for i := min to max do
if i mod k = 0 then
Summ := Summ + i;
writeln('Сумма = ', Summ);
program sada;
var k,n,res,i:integer;
temp:string;
begin
res:=0;
readln(k);
temp:='';
for i:=1 to n do
temp:=temp+'9';
n:=strtoint(temp);
for i:=1 to n do begin
if (i mod k = 0) then res:=res+i;
end;
writeln(res);
end.
p.s. Программа написана на pascalABC
var
k, n, Summ, i, max, min:integer;
begin
write('n = '); readln(n);
write('k = '); readln(k);
max := 9;
min := 1;
for i := 2 to n do
begin
max := max * 10 + 9;
min := min * 10;
end;
for i := min to max do
if i mod k = 0 then
Summ := Summ + i;
writeln('Сумма = ', Summ);
end.