nikolas_serafini

Lista 3 - Exercício 59

Jun 16th, 2013
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <limits.h>
  3.  
  4. int main()
  5. {
  6.     float salary,children, sumSalary = 0, sumChildren = 0, counter = 0, biggest = INT_MIN, habitants = 0;
  7.  
  8.     while (1)
  9.     {
  10.         printf("Entre com o salario :\n"); scanf("%f",&salary);
  11.         if (salary < 0)
  12.         {
  13.             break;
  14.         }
  15.         printf("Entre com o numero de filhos :\n"); scanf("%f",&children);
  16.  
  17.         sumSalary = sumSalary + salary;
  18.         sumChildren = sumChildren + children;
  19.         habitants++;
  20.  
  21.         if (salary > biggest)
  22.         {
  23.             biggest = salary;
  24.         }
  25.         if (salary > 100)
  26.         {
  27.             counter++;
  28.         }
  29.  
  30.     }
  31.     printf("MEDIA DO SALARIO = %f\nMEDIA DE FILHOS = %f\nMAIOR SALARIO = %f\nPERCENTUAL DE HABITANTES COM SALARIO SUPERIOR A R$ 100 = %f",sumSalary/habitants,sumChildren/habitants,biggest,counter/habitants*100);
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment