С++
#include
#include
int y(int x){
if(x<-2){<br> return (abs(x)+2);
}else if(x >= -2 && x<= 2){<br> return 1;
}else{
return (x+1);
}
}
using namespace std;
int main(){
int x;
cin>>x;
cout<<y(x)<<endl;<br> return 0;
}
Паскаль
Program pr;
uses crt;
var x :integer;
fubction y(x: integer) int a begin
if x<-2 then<br>a:= abs(x)+2;
else if (x>=-2) and (x<=2) then<br>a:= 1;
else a:= x+1;
end;
begin
readln(x);
whiteln(y(x));
end;