Skip to content

Instantly share code, notes, and snippets.

@joshmcarthur
Created August 9, 2011 22:39
Show Gist options
  • Save joshmcarthur/1135392 to your computer and use it in GitHub Desktop.
Save joshmcarthur/1135392 to your computer and use it in GitHub Desktop.
A method to calculate BMI in C#
#region Calculations
/** <summary>A method to calculate Body-Mass Index (BMI) from a given weight and height</summary>
* <param name="weight">The person's weight in kilograms</param>
* <param name="height">The person's height in kilograms</param>
*/
public decimal CalculateBMI(decimal weight, decimal height) {
bmi = Math.pow(weight / height, 2)
return Math.round(bmi, 2)
}
#endregion
@aleksmaslaric
Copy link

Line 5: The person's weight in kilograms?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment