The intent of this program would be to print the position linha
and coluna
where the largest value in the array is located, can someone tell me why the result is printing 0x0
and if there is another more effective way ? In my test of course, the biggest value you entered was not the first.
#include<stdio.h>
#include<stdlib.h>
int matriz[3][3],i,j,maior=0,i1,j1;
main(){
for(i=0;i<3;i++){
for(j=0;j<3;j++){
printf("Digite um valor: ");
scanf("%d",&maior);
if(matriz[i][j]>maior){
maior=matriz[i][j];
i1=i;
j1=j;
}//fim if
}//fim for j
}//fim for i
printf("%d x %d \n",i1,j1);
system("pause");
}//fim do main