+ 1

I want to capture 10 integers at random into an array D. How should i write a Pascal program to display the elements of the aray

using while do loop

10th Oct 2018, 9:00 AM
Caleb Kemboi
Caleb Kemboi - avatar
1 Réponse
+ 2
random(100) will give a random number between 0 and 99. This would define your index and array for the loop: var index: integer; arr: array [1..10] of integer; This would display the array: index := 1; while index <= 10 do begin writeln("Array[", index, "] is ", arr[index]); index := index+1; end; You would have to put the values into the array, first.
11th Oct 2018, 12:58 PM
John Wells
John Wells - avatar