필터 지우기
필터 지우기

The Body Mass Index, or BMI

조회 수: 7 (최근 30일)
Dai Nguyen
Dai Nguyen 2020년 9월 9일
댓글: Dai Nguyen 2020년 9월 9일
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

답변 (1개)

James Tursa
James Tursa 2020년 9월 9일
Just get rid of these lines:
function BMI=findbmi(Weight,Height)
  댓글 수: 8
Dai Nguyen
Dai Nguyen 2020년 9월 9일
oh nvm I got it
Dai Nguyen
Dai Nguyen 2020년 9월 9일
thank you

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by