Advertisement
weldisalves

Lista 01 - exercício 05

Jun 10th, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. /* 5. Calcule e exiba o percentual de homens e mulheres da sua turma. Solicite apenas os dados necessários. */
  4.  
  5. int main()
  6. {
  7.     float quantHomens,quantMulheres,total,porcentagemHomens,PorcentagemMulheres;
  8.  
  9.     printf("\n Digite a quantidade de homens e mulheres: ");
  10.     scanf("%f %f",&quantHomens,&quantMulheres);
  11.  
  12.     total = quantHomens + quantMulheres;
  13.  
  14.     porcentagemHomens = (quantHomens/total)*100;
  15.     PorcentagemMulheres = (quantMulheres/total)*100;
  16.  
  17.     printf("\n Percentual de homens: %.2f",porcentagemHomens);
  18.     printf("\n Percentual de mulheres: %.2f",PorcentagemMulheres);
  19.  
  20.     getch();
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement