RosettaCodeData/Task/Create-a-two-dimensional-array-at-runtime/Phix/create-a-two-dimensional-array-at-runtime.phix
2016-12-05 23:44:36 +01:00

13 lines
306 B
Text

sequence array
integer height,width,i,j
height = floor(prompt_number("Enter height: "))
width = floor(prompt_number("Enter width: "))
array = repeat(repeat(0,width),height)
i = floor(height/2+0.5)
j = floor(width/2+0.5)
array[i][j] = height + width
printf(1,"array[%d][%d] is %d\n", {i,j,array[i][j]})