182k views
4 votes
Write a program that creates a two-dimensional list named lengths and stores the following data:

20 15 16
15 16 15
16 15 16
The program should also print the list.

User Valik
by
8.0k points

1 Answer

0 votes

Answer:

Step-by-step explanation:

Following is the python code of your question:

lengths = [

[20, 15, 16],

[15, 16, 15],

[16, 15, 16]

]

print(lengths)

Following is the C code of your question:

#include <stdio.h>

int main() {

int lengths[3][3] = {

{20, 15, 16},

{15, 16, 15},

{16, 15, 16}

};

// Printing the array of named lengths

for (int i = 0; i < 3; i++) {

for (int j = 0; j < 3; j++) {

printf("%d ", lengths[i][j]);

}

printf("\\");

}

return 0;

}

User Eduardo Oliveros
by
8.4k points