The Body Mass Index, or BMI
22 views (last 30 days)
Show older comments
Hi I tried to write a function called findbmi that would receive the weight and height as input arguments, and would return the BMI but for some reason it's not working. Please help
this is my code
Weight= input('Enter your weight in lbs, or typer 0 for SI units:')
if Weight==0;
Weight=input('Enter your weight in kg:')
Height=input('Enter your height in m:')
function BMI=findbmi(Weight,Height)
BMI= (Weight/(Height^2)) %kg/m^2
else
Height=input('Enter your height in ft:')
function BMI=findbmi(Weight,Height)
BMI=(Weight/(Height^2))*4.882427111
end
0 Comments
Answers (1)
James Tursa
on 9 Sep 2020
Just get rid of these lines:
function BMI=findbmi(Weight,Height)
8 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!