Вот на Паскале
uses Crt;
var x, y: real;
k: integer;
begin
ClrScr;
Write (' X = '); ReadLn (x);
Write (' k = '); ReadLn (k);
if (k=2) then y:=sqr(x)+x+1;
if (k=3) then y:=sqr(x)*x+1;
if (k>3) and (k<7) and (x<>-1) then y:=1/abs(x+1);
if (k>7) or (k<2) then y:=sqrt(abs(x+k))+sqrt(abs(x-k));<br> WriteLn (' Y = ', y:8:3);
ReadLn;
end.