nikolas_serafini

Lista 5 - Exercício 1

Jun 29th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.    
  6.     int i,j;
  7.     float buildingEnergy[8][4],floorEnergy[8] = {0},secondColummnEnergy = 0;
  8.  
  9.     for (i = 0; i < 8; i++)
  10.     {
  11.         for (j = 0; j < 4; j++)
  12.         {
  13.             printf("Entre com o consumo medio do apartamento %d do %d andar:\n",j+1,i+1);
  14.             scanf("%f",&buildingEnergy[i][j]);
  15.             floorEnergy[i] += buildingEnergy[i][j];
  16.             if (j == 1)
  17.                 secondColummnEnergy += buildingEnergy[i][j];
  18.         }
  19.     }
  20.  
  21.     printf("Consumo total dos apartamentos da segunda coluna : %.3f\n",secondColummnEnergy);
  22.     for (i = 0; i < 8; i++)
  23.     {
  24.         printf("Consumo total do andar %d = %.3f\n",i+1,floorEnergy[i]);
  25.     }
  26.        
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment