TOPIC

10% de erro. No uDebug sempre sai correto.

João Victor Simão asked 1 year ago

include include

int main() { int linha, coluna,min = 1,max = 10; float matriz[12][12], num, soma = 0.0, cont = 0.0, media = 0.0; char op;

while(op != 'S' && op != 'M')
{
    scanf("%c\n", &op);
}
for (linha = 0; linha <= 11; linha++)
{
    for (coluna = 0; coluna <= 11; coluna++)
    {
        scanf("%f", &num);
        matriz[linha][coluna] = num;
    }
}
for (linha = 0; linha <= 4; linha++)
{
    for (coluna = min; coluna <= max; coluna++)
    {
       soma = soma + matriz[linha][coluna];
       cont++;
    }
    min++;
    max--;
}
 system("cls");
media = soma / cont;
if (op == 'S')
{
    printf("%.1f\n", soma);
}
if (op == 'M')
{
    printf("%.1f\n", media);
}
return 0;

}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.