Write a program in the Pascal program: Output first positive numbers from the segment [a; b], and then negative

Write a program in the Pascal program: Output first positive numbers from the segment [a; b], and then negative numbers from the segment [a; b] and the number of positive and negative numbers from the segment [a; b]

program zz1;

var a, b, r, i: integer; // set variables of integer type

begin

write (‘enter the first number’); // enter the first number from the keyboard

read (a);

write (‘enter the second number’); // enter the second number from the keyboard

read (b);

for i: = a to b do

begin

if i> 0 then write (”, i); // display the first answer

r: = r + 1;

end;

writeln;

writeln (‘number of positive =’, r); // print the second answer

r: = 0;

for i: = a to b do

begin

if i <0 then write (”, i); // print the third answer

r: = r + 1;

end;

writeln;

writeln (‘number of negative =’, r); // print the fourth 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.