-1
I’m having a problem where I assign values to the matrix and to the vector but I still have the attribution error. I’m new to the forum and I still don’t know how things work right, if information is missing or something was done wrong I correct; I thank you from now on.
const int OsEmpresarios = 4;
const int GanhosMensais = 4;
float SalariosEmpresarios [4][4] = {0};
float MediaSalarios [4] = {0};
float Media = 0;
int empresario = 0, salario = 0;
printf("Digite os salários do 1° empresário:\n");
for (empresario = 0; empresario < OsEmpresarios; ++empresario){
for (salario = 0; salario < GanhosMensais; ++salario){
scanf("%f", &SalariosEmpresarios [empresario][salario]);
Media += SalariosEmpresarios [empresario][salario];
}
MediaSalarios = Media / 4;
Media = 0;
printf("digite os salários do %i° empresário:\n", empresario + 2);
}
for (empresario = 0; empresario < OsEmpresarios; ++empresario){
printf("A média salarial do empresario %i° = %.2f\n", empresario + 1, MediaSalarios[empresario]);
}
Nice guy, thank you very much, that’s really what was missing
– Marcelo Henrique
Could you put as a right answer? Last thing there, as it is inside a for, the position you want would be: entrepreneur. Getting: Mediasalaries[entrepreneur] = Media/4;
– Danilo Lima
I did it, it was something I really forgot, and I just came to remember it now. of course I can, your answer is correct, the only thing, I don’t know where I can attribute to an answer that it is correct
– Marcelo Henrique
Next to my reply has an option mark as correct by clicking on the green symbol below the vote button.
– Danilo Lima