0
I need to create a program that will build me a matrix and give me back the media of your numbers.
I already have the matrix built but I can’t average the values.
The code I already have:
#include<stdio.h>
#include<stdlib.h>
int main(void){
int matriz [3][3] ={{0}}, i, j;
for(i=0;i<3;i++){
for(j=0;j<3;j++){
printf("introduza numeros para a matriz nos lugares [%d][%d] \n", i+1, j+1);
scanf("%d", &matriz[i][j]);
}
}
printf("\n\t");
printf("estes sao os valores da matriz\n\n");
printf("\t\t matriz ordenada");
for(i=0; i<3; i++){
printf("\n");
for(j=0;j<3;j++){
printf("%6d", matriz[i][j]);
}
}
printf("\n");
}
Thank you Tiago for editing the question
– DidiMaster
What this print, ordered matrix test ma you see with the problem?
– Maniero
No, no. This is to build the matrix what I wanted now was to average the values of the matrix
– DidiMaster
but this is not building the matrix.
– Maniero
When I run this code and enter the numbers the matrix is built
– DidiMaster
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero