Heres what I've done so far:
int main (void) {
int status=0, i=0, j=0;
int x[3][3];
char line[100];
printf("Enter 3 x 3 matrix:\n");
for(i=1; i<=3; i++) {
printf("Enter points of row %d:\n", i);
for(j=0; j<=2; j++) {
while(1) {
fgets(line, sizeof(line), stdin);
status = sscanf(line, "%d", &x[i][1+j]);
if (status==0) printf("Invalid point.\n");
else break;
}
}
}
printf("Data input:\n\n");
for(i=1; i<3; i++) {
for(j=0; j<2; j++) {
printf("%d\n", x[i][1+j]);
}
}
return 0;
}
It needs to calculate the transpose of the matrix too, but actually getting the thing to input properly is my major concern right now.
Help please!


Sign In
Create Account

Back to top









