Knowee
Questions
Features
Study Tools

Banana Saplings are planted in a garden.Different varieties of saplings are planted.N saplings are planted in M rows.Read the N and M values .Read the cost of each saplings.Print the cost of saplings as two dimensional array.Sample Input3 4 (Row and Column value)12 10 13 14 10 8 7 12 9 8 10 12 Sample Output12 10 13 14 10 8 7 12 9 8 10 12

Question

Banana Saplings are planted in a garden.Different varieties of saplings are planted.N saplings are planted in M rows.Read the N and M values .Read the cost of each saplings.Print the cost of saplings as two dimensional array.Sample Input3 4 (Row and Column value)12 10 13 14 10 8 7 12 9 8 10 12 Sample Output12 10 13 14 10 8 7 12 9 8 10 12

🧐 Not the exact question you are looking for?Go ask a question

Solution

The problem is asking to create a two-dimensional array (matrix) to represent the cost of each sapling in a garden. The garden is organized in rows and columns, with each cell in the matrix representing the cost of a sapling.

Here are the steps to solve this problem:

  1. Read the values of N and M. These represent the number of rows and columns in the garden, respectively.

  2. Create an empty two-dimensional array (matrix) with N rows and M columns.

  3. For each row in the matrix, read the cost of each sapling (M values) and store them in the corresponding row of the matrix.

  4. Print the matrix.

Here is a Python code snippet that implements these steps:

# Read the values of N and M
N, M = map(int, input().split())

# Create an empty matrix
matrix = []

# For each row
for i in range(N):
    # Read the cost of each sapling and store them in the matrix
    matrix.append(list(map(int, input().split())))

# Print the matrix
for row in matrix:
    print(' '.join(map(str, row)))

In the sample input, N is 3 and M is 4. The costs of the saplings are read row by row and stored in the matrix. The matrix is then printed, resulting in the sample output.

This problem has been solved

Similar Questions

Array-4Banana Saplings are planted in a garden. Different varieties of saplings are planted.N saplings are planted in M rows.Read the N and M values.Read the cost of each sapling.Sort the cost of the sapling rowwise in ascending order and print the cost of saplings as two-dimensional array.Sample Input3 4 (Row and Column value)12 10 13 14 10 8 7 12 9 8 10 12 Sample Output10 12 13 14 7 8 10 12 8 9 10 12

anana Saplings are planted in a garden.Different varieties of saplings are planted.N saplings are planted in M rows.Read the N and M values .Read the cost of each saplings.Print the cost of saplings as two dimensional array.Sample Input3 4 (Row and Column value)12 10 13 14 10 8 7 12 9 8 10 12 Sample Output12 10 13 14 10 8 7 12 9 8 10 12

On the occasion of Van Mahotsav it was decided by the Secretary of Residents Welfare Association to plant saplings of Ashoka trees and Mango trees in the locality. Accordingly Ashoka trees were planted in (3x + 1) rows having (x3 + x2 – 1) trees in each row and Mango trees were planted in (x – 3) rows having (2x2 + 1) trees in each row.(i) Find the total number of trees planted.

A blight is spreading in a banana plantation. Currently, 458 banana plants are infected. If the disease is spreading at a rate of 8% each year, how many plants will be infected in 8 years?If necessary, round your answer to the nearest whole number. banana plants

After selling 1 dozen bananas, Akul earns a profit equal to the cost price of 4 bananas. Find profit made by Akul.66236623%14271427%12121212%33133313%

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.