Matriz
Publicado por Uziel (1 intervención) el 30/03/2020 22:22:43
ayuda porfavor lo tengo que convertir a lenguaje C, este en C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include<iostream>
using namespace std;
int main(){
int m,n;
cout<<"Suma de matrices mxn"<<endl;
cout<<"Ingrese m: ";
cin>>m;
cout<<"Ingrese n: ";
cin>>n;
cout<<"*****"<<endl;
int mat1[m][n], mat2[m][n];
cout<<"Llenado de matriz 1"<<endl;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cout<<"Ingrese numero: ";
cin>>mat1[i][j];
}
}
cout<<"\n";
cout<<"*****"<<endl;
cout<<"Llenado de matriz 2"<<endl;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cout<<"Ingrese numero: ";
cin>>mat2[i][j];
}
}
cout<<"\n";
cout<<"La matriz 1 es: "<<endl;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cout<<mat1[i][j]<<" ";
}
cout<<endl;
}
cout<<"\n";
cout<<"La matriz dos es: "<<endl;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cout<<mat2[i][j]<<" ";
}
cout<<endl;
}
cout<<"\n";
cout<<"La suma de las dos matrices es:"<<endl;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cout<<mat1[i][j]+mat2[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
Valora esta pregunta


0