INTEGER ARRAYS
Arrays can hold any of the valid data types, including integers.
Integer arrays cannot be read or written as an entire unit, only
packed character arrays can. The following program demonstrates an
integer array, where ten successive numbers are inputted, stored
in separate elements of the array numbers, then finally outputted
to the screen one at a time.
program INT_ARRAY (input,output ); type int_array = ARRAY [1..10] of integer; var numbers : int_array; loop : integer; begin writeln('Please enter in up to ten integers.'); for loop := 1 to 10 do readln( numbers[loop] ); writeln('The contents of numbers array is '); { print out each element } for loop := 1 to 10 do writeln('numbers[',loop:2,'] is ',numbers[loop] ) end.SELF TEST
program ARRAY_TEST (output); var numbers : ARRAY [1..5] of integer; begin numbers[1] := 7; numbers[2] := 13; numbers[3] := numbers[2] - 1; numbers[4] := numbers[3] DIV 3; numbers[5] := numbers[3] DIV numbers[4]; for loop := 1 to 5 do writeln('Numbers[',loop,'] is', numbers[loop] ) end.Click here for answer