Created
February 24, 2017 20:22
-
-
Save FelipeGrijo/0932ad38f344a37e7674f4aba050021b to your computer and use it in GitHub Desktop.
6) Construa um algoritmo que calcule o peso ideal de uma pessoa. Dados de entrada: altura e sexo. Fórmulas para cálculo do peso: peso ideal de homem = (72,7 x altura) - 58 - peso ideal da mulher = (62,1 x altura) - 44,7*/
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
//https://gist.github.com/FelipeGrijo | |
#include <stdio.h> | |
int main() | |
{ | |
float Altura,AlturaxPeso=0.0; | |
char Sexo; | |
printf("Exercicio 6\nDigite a sua altura (Ex.: 1.75):"); | |
fflush(stdin); | |
scanf("%f",&Altura); | |
printf("Digite o seu sexo (M para Masculino e F para Feminino):"); | |
fflush(stdin); | |
scanf("%c",&Sexo); | |
if(Sexo == 'M'){ | |
AlturaxPeso+=((72.7*Altura)-58); | |
printf("O seu peso ideal e: %.3f\n",AlturaxPeso); | |
} | |
else | |
{ | |
AlturaxPeso=((62.1*Altura)-44.7); | |
printf("O seu peso ideal e: %.3f\n",AlturaxPeso); | |
} | |
system("pause"); | |
return 0; | |
} |
jonathanac85
commented
Jan 15, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment