–1 vote

#Create a list of lists for both variables x and y

X = [[12,7,3],

[4 ,5,6],

[7 ,8,9]]

Y = [[5,8,1],

[6,7,3],

[4,5,9]]

#Defining a variable called result

result = [[0,0,0],

[0,0,0],

[0,0,0]]

# iterate through rows

for i in range(len(X)):

# iterate through columns

for j in range(len(X[0])):

result[i][j] = X[i][j] + Y[i][j]

for r in result:

print(r)

X = [[12,7,3],

[4 ,5,6],

[7 ,8,9]]

Y = [[5,8,1],

[6,7,3],

[4,5,9]]

#Defining a variable called result

result = [[0,0,0],

[0,0,0],

[0,0,0]]

# iterate through rows

for i in range(len(X)):

# iterate through columns

for j in range(len(X[0])):

result[i][j] = X[i][j] + Y[i][j]

for r in result:

print(r)

commented
Jan 14
by
[email protected]

create a one program..not a one by one programs

0 votes

But you need to say in which language you want to...

I am learning C++ and here is the code:

int findSum(int x, int y) {

return x + y;

}

int findSubtraction(int x, int y) {

return x - y;

}

int findMultiplication(int x, int y) {

return x * y;

}

I don't know what the transpose of matrices is.

+1 vote

For C language:

#include <stdio.h>

#include <conio.h>

void main()

{

int a,b;

printf("enter the first number: ");

scanf("%d",&a);

printf("enter the second number: ");

scanf("%d",&b);

int c=a+b;

printf("the sum of two numbers is: %d",c);

getch();

}

Similarly for the place of subtraction and multiplication, just use c=a-b and c=a*b respectively

Also in the last printf mention the difference of the two numbers is and the product of the two numbers is respectively.

#include <stdio.h>

#include <conio.h>

void main()

{

int a,b;

printf("enter the first number: ");

scanf("%d",&a);

printf("enter the second number: ");

scanf("%d",&b);

int c=a+b;

printf("the sum of two numbers is: %d",c);

getch();

}

Similarly for the place of subtraction and multiplication, just use c=a-b and c=a*b respectively

Also in the last printf mention the difference of the two numbers is and the product of the two numbers is respectively.

...