Two numbers
n
and
m
are given. Create a two-dimensional array of dimension
nxm
and fill it according to the following rule:
- numbers in row
0
or column
0
are equal to 1 (
A[0][j]=1
,
A[i][0]=1
);
- the values of the remaining elements of the array must be equal to the sum of the elements one column to the left and one line above this element.
Input
The program receives two numbers
n
and
m
as input.
Imprint
Display the resulting array.
Examples
# |
Input |
Output |
1 |
3 3
|
1 1 1
1 2 3
1 3 6
|