Advertisement
Guest User

123

a guest
Feb 20th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. float pesoIdeal(float h, char sexo){
  6. printf("The Ideal Weight(PI) is: ");
  7. if (sexo == 'M'){
  8. float PI = (72.7 * h) - 58;
  9. return PI;
  10. }
  11. else {
  12. float PI = (62.1 * h) - 44.7;
  13. return PI;
  14. }
  15. printf("\n");
  16. }
  17. int main(){
  18. float altura;
  19. float peso;
  20. char sexo;
  21. printf("Insira seu peso, altura e sexo: \n");
  22. scanf("%f",&peso);
  23. scanf("%f",&altura);
  24. scanf("%c",&sexo);
  25. float PI = pesoIdeal(altura, sexo);
  26. printf("%f", PI);
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement