37 lines
812 B
C#
Raw Permalink Normal View History

2021-09-02 08:31:01 -03:00
using System;
namespace exercicios
{
public class Exercicio6
{
public static void Init()
{
string sexo;
float i_altura;
Console.WriteLine("Biological sex (male/female):");
sexo = Console.ReadLine();
Console.WriteLine("Height (in meters):");
i_altura = float.Parse(Console.ReadLine());
Console.WriteLine("\n{0:N2} is the ideal weight for a {1}, with the height of: {2}m",
calcularPesoIdeal(i_altura,sexo),sexo,i_altura);
}
static float calcularPesoIdeal(float i, string s)
{
switch(s.ToLower())
{
case "male":
return (72.7f*i)-58f;
case "female":
return (62.1f*i)-44.7f;
default:
Console.WriteLine("\nWrite a valid value!");
break;
}
return 0;
}
}
}