Have written a program to multiply maatrices( as im sure you can guess by some other posts, signs of a desperation so apologies).think i have solved everything bar actually displaying the matrices on the screen. problem is that the first matrices instead of displaying properly either run in to the the next disply line or miss off the bottom rows of the matrix, however when i remove the following code and reompile it displays fine. secondly the result matrix will only display one or two correct values for the elements and give 0's for the rest.

code so far

eg of what i mean for result display instead of getting:Code:#include <stdio.h> #define MAX_R 4 #define MAX_C 4 #define MAX_C2 4 #define MAX_R2 4 int OrdEnt (char a, int *r, int *c) {do { printf("Enter the order of Matrix %d in the format NxN:\n",a); scanf ("%dx%d",&*r,&*c); if (*r>4 || *c>4) { printf("Order too great\n"); } } while (*r>4 || *c>4); return (0); } int main(void) { int R = 0, C = 0, R2 = 0, C2 = 0; int Matrix_A [MAX_R] [MAX_C]; int Matrix_B [MAX_R2] [MAX_C2]; int Matrix_C [MAX_R] [MAX_C2]; int a = 1, b = 2; int c_i, r_i, N, sum; char in_c; printf("This program will multiply 2 matrices (up to the order or 4x4),and display the result\n"); do{ OrdEnt(a,&R,&C); printf("Is this correct,y/n?:"); scanf(" %c",&in_c); } while(in_c == 'n' || in_c == 'N'); for(r_i=0; r_i<R; r_i++){ printf("\nfor row %d of Matrix_A\n",r_i +1); for(c_i=0; c_i<C; c_i++){ printf("\tEnter element value for column %d:",c_i +1); scanf("%d",&Matrix_A [r_i] [c_i]); } } printf("\nMatrix A is: \n"); for(r_i=0; r_i<R; r_i++){ for(c_i=0; c_i<C; c_i++) { printf("%3d",Matrix_A [r_i] [c_i]); if(c_i != (C - 1)) continue; printf("\n"); } do{ OrdEnt(b,&R2,&C2); printf("Is this correct,y/n?:"); scanf(" %c",&in_c); } while(in_c == 'n' || in_c == 'N'); for(r_i=0; r_i<R2; r_i++){ printf ("\nFor row % of Matrix B\n",r_i +1); for(c_i=0; c_i<C2; c_i++){ printf("\tEnter element value for column %d:",c_i +1); scanf("%d",&Matrix_B [r_i] [c_i]); } } printf("\nMatrix B is: \n"); for(r_i=0; r_i<R2; r_i++){ for(c_i=0; c_i<C2; c_i++) { printf("%3d",Matrix_B [r_i] [c_i]); if(c_i != (C2 - 1)) continue; printf("\n"); } } for(r_i=0; r_i<R2; r_i++){ for(c_i=0; c_i<C; c_i++){ sum = 0; for(N=0; N<R; N++) sum += Matrix_A [r_i] [N] * Matrix_B [N] [c_i]; Matrix_C [r_i] [c_i] = sum; } printf("\nMatrix C is: \n"); for(r_i=0; r_i<R; r_i++){ for(c_i=0; c_i<C2; c_i++) { printf("%4d",Matrix_C [r_i] [c_i]); if(c_i != (C2 - 1)) continue; printf("\n"); } } } } return (0); }

I will getCode:Matrix C is: 3834 864 142 12 639 144

Any ideas? im sorry if people on the board are being to think im a bit whiney but this is the first time ive ever tried programming and the frustration of having it half work is beyone description.Code:3844 0 0 0 0 0

Thanks in advance to anyone