Created
March 17, 2015 03:18
-
-
Save gtcarlos/cd1a66c4363054aab0c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main () | |
{ | |
float peso_ideal, peso_atual, altura; | |
char sexo; | |
do { | |
printf("Digite sua altura: "); | |
scanf("%f", &altura); | |
printf("Digite seu peso: "); | |
scanf("%f", &peso_atual); | |
printf("Digite seu sexo (M ou F): "); | |
scanf(" %c", &sexo); | |
if (sexo != 'M' && sexo != 'F') | |
{ | |
printf("\n* Sexo desconhecido *\n\n"); | |
} | |
} while (sexo != 'M' && sexo != 'F'); | |
if (sexo == 'M') | |
{ | |
peso_ideal = (72.7 * altura) - 58; | |
} | |
else if (sexo == 'F') | |
{ | |
peso_ideal = (62.1 * altura) - 44.7; | |
} | |
printf("\nSeu peso ideal: %.3f\n", peso_ideal); | |
if (peso_ideal > peso_atual) | |
{ | |
printf("\nVoce esta abaixo do peso.\n"); | |
} | |
else if(peso_ideal < peso_atual) | |
{ | |
printf("\nVoce esta acima do peso.\n"); | |
} | |
else | |
{ | |
printf("\nVoce esta no peso ideal.\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment