Increase the number x by 10, if it is positive, in all other cases, decrease it by 10.

Let’s compose a program for increasing the number if it is positive and decreasing it if it is negative:

Program 1;

Var x: integer;

begin

writeln (‘enter any integer’);

readln (x);

if x> o then

x: = x + 10;

writeln (‘The initial number has increased by 10 and =’, x);

else

x: = x – 10;

writeln (‘The initial number decreased by 10 and =’, x);

end.

Let’s check the work of the program by going through the code sequentially:

Enter any integer from the keyboard:

1) x = 100;

Let’s move on to the comparison:

100> 0 (x> 0),

means:

x = x + 10 = 100 + 10 = 110.

The screen displays:

The seed increased by 10 and = 110;

2) x = -5;

Let’s move on to the comparison:

-5 <0 (x <0),

means:

x = x – 10 = -5 – 10 = -15.

The screen displays:

The initial number decreased by 10 and = -15;



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.