|
1 |
| -# `26`Two dimensional array |
| 1 | +# `26` Two dimensional array |
| 2 | + |
| 3 | +## 📝 Instructions: |
| 4 | + |
| 5 | +1. Write a program which takes 2 digits, X,Y as input and generates a 2-dimensional array. The element value in the i-th row and j-th column of the array should be i*j. |
2 | 6 |
|
3 |
| -Write a program which takes 2 digits, X,Y as input and generates a 2-dimensional array. The element value in the i-th row and j-th column of the array should be i*j. |
4 | 7 | Note: i=0,1.., X-1; j=0,1,¡Y-1.
|
5 |
| -Example |
6 |
| -Suppose the following inputs are given to the program: |
7 |
| -3,5 |
8 |
| -Then, the output of the program should be: |
9 |
| -[[0, 0, 0, 0, 0], [0, 1, 2, 3, 4], [0, 2, 4, 6, 8]] |
10 |
| - |
11 |
| -Hints: |
12 |
| -Note: In case of input data being supplied to the question, it should be assumed to be a console input in a comma-separated form. |
| 8 | + |
| 9 | + |
| 10 | +```text |
| 11 | +Q = Square root of (2 * c * d) / h |
| 12 | +``` |
| 13 | + |
| 14 | +*Following are the fixed values of `c` and `h`:* |
| 15 | + |
| 16 | ++ `c` is 50. |
| 17 | ++ `h` is 30. |
| 18 | ++ `d` would be the parameter of the function. |
| 19 | + |
| 20 | +## 📎 Example input: |
| 21 | + |
| 22 | +```py |
| 23 | +two_dimensional_array(3,5) |
| 24 | +``` |
| 25 | + |
| 26 | +## 📎 Example output: |
| 27 | + |
| 28 | +```py |
| 29 | +[[0, 0, 0, 0, 0], [0, 1, 2, 3, 4], [0, 2, 4, 6, 8]] |
| 30 | +``` |
| 31 | + |
| 32 | +## 💡 Hints: |
| 33 | + |
| 34 | ++ If the output received is in decimal form, it should be rounded off to its nearest value (for example, if the output received is 26.0, it should be printed as 26). |
| 35 | + |
| 36 | ++ Import the `math` module. |
0 commit comments