Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. float imc (float peso, float altura, char sexo)
  6. {
  7. float valorImc;
  8.  
  9. valorImc = peso / (altura * altura);
  10.  
  11. return valorImc;
  12.  
  13. }
  14.  
  15. int main()
  16. {
  17. float peso, altura, valorImc;
  18. char sexo;
  19.  
  20. printf("\n Informe o Sexo: ");
  21. fflush(stdout);
  22. scanf("%c", &sexo);
  23.  
  24. printf("\n Informe o Peso: ");
  25. fflush(stdout);
  26. scanf("%f", &peso);
  27.  
  28. printf("\n Informe a altura: ");
  29. fflush(stdout);
  30. scanf("%f", &altura);
  31.  
  32. valorImc = imc(peso, altura, sexo);
  33.  
  34. if (valorImc > 25)
  35. printf("\n A pessoa do sexo %c esta com indice %f e esta acima do peso", %sexo, %valorImc);
  36. else
  37. printf("\n A pessoa do sexo %c esta com indice %f e esta com peso normal", %sexo, %valorImc);
  38.  
  39.  
  40. Sisten("PAUSE");
  41. return 0;
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement