I want matrix M to output the value of G correctly please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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; }

8th May 2019, 2:36 PM
Source_code
Source_code - avatar
5 Answers
+ 1
Thanks very much I now understand
8th May 2019, 3:49 PM
Source_code
Source_code - avatar
+ 1
Thanks very much
8th May 2019, 4:08 PM
Source_code
Source_code - avatar
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; }
8th May 2019, 3:41 PM
Source_code
Source_code - avatar
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; }
8th May 2019, 3:55 PM
Source_code
Source_code - avatar
0
But it's still giving 0.00
8th May 2019, 3:55 PM
Source_code
Source_code - avatar