Программа


Program Pilshikov_5_57_02 (input,output);
{ Задано натуральное k.
  Напечатать k-ю цифру
  последовательности 149162536...,
  в которой выписаны подряд квадраты
  всех натуральных чисел. }
Var K,
    CurrentQuantitySymbol,
    CurrentInteger,
    SqrCurrentInteger,
    SqrCurrentIntegerVar:integer;
    KSymbol:0..9;
BEGIN
  Write('Введите K ');
  Readln(K);
  CurrentInteger:=1;
  repeat
    SqrCurrentIntegerVar:=Sqr(CurrentInteger);
    CurrentQuantitySymbol:=0;
    while SqrCurrentIntegerVar>0 do
      begin
        SqrCurrentIntegerVar:=SqrCurrentIntegerVar div 10;
        CurrentQuantitySymbol:=CurrentQuantitySymbol+1
      end;
    if K>CurrentQuantitySymbol then begin
                                      K:=K-CurrentQuantitySymbol;
                                      CurrentInteger:=CurrentInteger+1
                                    end
  until K<=CurrentQuantitySymbol;
  SqrCurrentInteger:=Sqr(CurrentInteger);
  for K:=K to CurrentQuantitySymbol-1 do
    SqrCurrentInteger:=SqrCurrentInteger div 10;
  KSymbol:=SqrCurrentInteger mod 10;
  Writeln(KSymbol)
END.



Бесплатные примеры программ
Примеры написанных программ
Помощь студентам по программированию