Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <limits.h>
- int main()
- {
- float salary,children, sumSalary = 0, sumChildren = 0, counter = 0, biggest = INT_MIN, habitants = 0;
- while (1)
- {
- printf("Entre com o salario :\n"); scanf("%f",&salary);
- if (salary < 0)
- {
- break;
- }
- printf("Entre com o numero de filhos :\n"); scanf("%f",&children);
- sumSalary = sumSalary + salary;
- sumChildren = sumChildren + children;
- habitants++;
- if (salary > biggest)
- {
- biggest = salary;
- }
- if (salary > 100)
- {
- counter++;
- }
- }
- 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);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment