1
I’m having a problem in at least all my matrices made in class, I even caught a fixed problem of the internet and my matrix on PC is still showing random numbers.
the code is as follows: :
void main (void){
int matriz[3][3], i, j, rot[3][3];
for(i=0;i<3;i++) {
for(j=0;j<3;j++) {
printf("Digite o valor da matriz[%i][%i]: ",i+1, j+1);
scanf("%i", &matriz[j]);
}
}
//mostrando a matriz inicial
for(i=0;i<3;i++) {
printf("\n");
for(j=0;j<3;j++) {
printf(" %i ", matriz[j]);
}
}
//rotacionando a matriz
for(i=0;i<3;i++) {
if(i==0){
for(j=0;j<3;j++){
rot[j][2]=matriz[j];
}
}
if(i==1){
for(j=0;j<3;j++){
rot[j][1]=matriz[j];
}
}
if(i==2){
for(j=0;j<3;j++){
rot[j][0]=matriz[j];
}
}
}
//mostrando a matriz rotacionada
printf("\nMATRIZ 90º\n");
for(i=0;i<3;i++) {
printf("\n");
for(j=0;j<3;j++) {
printf(" %i ", rot[j]);
}
}
}