Write a program for entering elements of array b [1..6] from the keyboard and displaying elements with positive values.
March 25, 2021 | education
| Let’s denote an array of six numbers by the letter a. The ordinal number of array elements is the letter i, and the values of array elements are a [i]. We will use the loop operator with the for parameter. Then a program in the Pascal ABC programming language may look like this:
program zadacha;
uses crt;
var a: array [1..6] of integer; {Description of the array}
i: integer;
begin
for i: = 1 to 6 do begin
writeln (‘vvedite a [i]:’);
readln (a [i]); {Entering array elements from the keyboard during program execution}
end;
for i: = 1 to 6 do
if a [i]> 0 {Find positive array elements}
then writeln (‘a [i] =’, a [i]); {Displaying positive array elements to the screen}
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.