Given weight in kgs and height in metres, calculate body mass index
Solution Stats
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers33
Suggested Problems
-
Calculate the area of a triangle between three points
3414 Solvers
-
Sum of first n positive integers
622 Solvers
-
07 - Common functions and indexing 6
467 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
398 Solvers
-
the average value of the elements
2238 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
A few more test cases would be nice.
Most of the solutions seem to complicate the calculation to artificially compensate for the fact that the test problem result is in error by 0.01.
Re: the value in the single test case, it's possible that you're supposed to truncate at two decimal digits as well. Which actually makes me wish MATLAB had something like floor(x, 2) and ceil(x, 2), akin to round(x, 2).