Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- // prédio com 32 apartamentos
- // 8 andares e 4 aptos por andar
- float consumo[8][4];
- int l,c;
- for(l=0; l<8; l++) {
- for(c=0; c<4; c++) {
- printf("Entre consumo do andar %d e apto %d:", l+1, c+1);
- scanf("%f", &consumo[l][c]);
- }
- }
- float soma = 0;
- for(l=0; l<8; l++) {
- soma = soma + consumo[l][1];
- }
- printf("Consumo total dos aptos da coluna 2: %f", soma);
- float soma2 = 0;
- for(c=0; c<4; c++) {
- soma2 += consumo[4][c];
- }
- printf("Consumo total dos aptos do andar 5: %f", soma2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement