TOPIC

85% de erro - Socorro

Camila Bianca Silva Caldas asked 1 year ago

Já rodei todos os teste do udebug e todos deram certo.

include include <bits/stdc++.h>

int main(){ int i,j,cont=0; double M[100][100],sum,media; char Op; //Recebe o tipo de Operação scanf(" %c",&Op);

//Recebe valores da matriz 12x12
for(i=0;i<12;i++){
    for(j=0;j<12;j++){
        scanf("%lf",&M[i][j]);  
    }
}

if(Op=='S'){
    for(i=0;i<12;i++){
        for(j=0;j<11-i;j++){
            sum=sum+M[i][j];
        }
    }
    printf("%.1lf\n",sum);
}else if(Op=='M'){
    for(i=0;i<12;i++){
        for(j=0;j<11-i;j++){
            sum=sum+M[i][j];
            cont++;
        }
    }
    media=sum/cont;
    printf("%.1lf\n",media);
}

return 0;

}

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