0
I have to add the values that have two or more decimals but when I put by Exp: "1.0", it fills this whole row automatically and jumps to the next, I reviewed and I don’t know why you are giving error so I appreciate if I can help.
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main () { setlocale(LC_ALL,"Portuguese");
float matriz[7][4], soma = 0;
for ( int i = 0; i < 7; i++){
for ( int h = 0; h < 4; h++){
printf("\nInforme o valor da linha %i e coluna %i: ",i,h);
scanf("%f",&matriz[i][h]);
}
system ("cls");
}
for (int c = 0; c < 7; c++){
for ( int k = 0; k < 4; k++){
soma += matriz[c][k];
}
}
printf("\nO valor é: %.0f\n",soma);
return 0;
}
It would be better, in my opinion, to leave the locale as predefined for input and change it only to output.
– pmg
Cool, but how do I know it just for output ? ( e vlw Carlos, silly error of attention )
– Luis Souza