program SumSquares;
varn, k, sum, squaredSum: Integer;
beginWrite('Enter a number K: ');Readln(k);
sum := 0;n := 1;
while sum + n n <= k dobeginsum := sum + n n;n := n + 1;end;
squaredSum := (n - 1) * (n - 1);
Writeln('The number n is ', n - 1);Writeln('The sum of squares is ', squaredSum);end.
program SumSquares;
var
n, k, sum, squaredSum: Integer;
begin
Write('Enter a number K: ');
Readln(k);
sum := 0;
n := 1;
while sum + n n <= k do
begin
sum := sum + n n;
n := n + 1;
end;
squaredSum := (n - 1) * (n - 1);
Writeln('The number n is ', n - 1);
Writeln('The sum of squares is ', squaredSum);
end.