0
I want matrix M to output the value of G correctly please
#include<conio.h> #include<stdio.h> int main() { int i,j; int G[3][4] ={ {1, 2, 3, 9}, {0, 5, 2, 9}, {6, 4, 8, 8} }; double B[3][4], M[3][4]; for (i=0; i<3; i++) { for (j=0; j<4; j++){ (double) (G[3][4]); G[3][4] = M[i][j]; } } for (i=0; i<3; i++) { for (j=0; j<4; j++){ printf(" %2.2fl",&M[i][j]); } printf("\n\n"); } return 0; }
5 Answers
+ 1
Thanks very much I now understand
+ 1
Thanks very much
0
I have corrected it but its still giving the same result.
#include<conio.h>
#include<stdio.h>
int main()
{
int i,j;
int G[3][4] ={
{1, 2, 3, 9},
{0, 5, 2, 9},
{6, 4, 8, 8}
};
int M[3][4];
for (i=0; i<3; i++) {
for (j=0; j<4; j++){
M[3][4] = (double) G[i][j];
}
}
for (i=0; i<3; i++) {
for (j=0; j<4; j++){
printf(" %2.2f",&M[i][j]);
} printf("\n\n");
}
return 0;
}
0
#include<conio.h>
#include<stdio.h>
int main()
{
int i,j;
int G[3][4] ={
{1, 2, 3, 9},
{0, 5, 2, 9},
{6, 4, 8, 8}
};
int M[3][4];
for (i=0; i<3; i++) {
for (j=0; j<4; j++){
M[i][j] = (double) G[i][j];
}
}
for (i=0; i<3; i++) {
for (j=0; j<4; j++){
printf(" %2.2f",M[i][j]);
} printf("\n\n");
}
return 0;
}
0
But it's still giving 0.00