An integer is given. If it is positive, then add 1 to it; if it is negative, then subtract 2

An integer is given. If it is positive, then add 1 to it; if it is negative, then subtract 2, if it is zero, then replace it with 10. output the resulting number. program.

program zz1;
var a, b: integer; // set variables of integer type
begin
write (‘enter a three-digit number’); // enter a three-digit number from the keyboard
read (a);

if a> 0 then b: = a + 1; // check the first condition
if a <0 then b: = a – 2; // check the second condition
if a = 0 then b: = 10; // check the third condition

writeln (‘received number =’, b); // display the answer
end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.