Create an assembly language program that calculates a persons Body Mass Index (B
ID: 663525 • Letter: C
Question
Create an assembly language program that calculates a persons Body Mass Index (BMI). Use floating-point variables and the floating-point instructions found and described in Chapter 12.
You will need the persons height in inches and their weight in pounds.
The formula to calculate the Body Mass Index is:
BMI = ( W * 703 ) / ( H * H )
Where: BMI = Body Mass Index
W = weight in pounds
H = height in inches
In addition to correctly calculating the numeric value of the BMI, your program should also display the descriptive word that corresponds to the following range of BMI values:
Range of BMI Values
Description
Less than 18.5
Underweight
18.5 or greater, but less than 25
Normal
25 or greater, but less than 30
Overweight
30 or greater
Obese
Your program should do the following:
1. Prompt the user for their weight in pounds.
2. Prompt the user for their height in inches.
3. Echo the weight and height values back to the User.
3. Calculate and display the BMI value.
4. Display the descriptive word that corresponds to their BMI value.
Range of BMI Values
Description
Less than 18.5
Underweight
18.5 or greater, but less than 25
Normal
25 or greater, but less than 30
Overweight
30 or greater
Obese
Explanation / Answer
// CALCULATING BODY MASS INDEX (BMI)
#include <stdio.h>
#include <stdlib.h>
#define Constant 703
void main()
{
float Height;
float Weight;
float BMI;
system("clear");
printf("Weight in (Pounds): ");
scanf("%f",&Weight);
printf("Height in(Inches): ");
scanf("%f",&Height);
BMI=(Weight*Constant)/(Height*Height);
if(BMI<18.5)
{
printf(" ============================================================ ");
printf(" | WEIGHT(Pounds) |HEIGHT(Inches) | BMI(Body Mass Index) | ");
printf(" ============================================================ ");
printf(" | %5f| %8f | %10f| ",Weight,Height,BMI);
printf(" ____________________________________________________________ ");
printf(" BMI Value is %f ",BMI);
printf(" You are Under Weight ");
printf(" ---------THANK YOU---------- ");
}
else if(BMI>=18.5 && BMI<25)
{
printf(" ============================================================ ");
printf(" | WEIGHT(Pounds) |HEIGHT(Inches) | BMI(Body Mass Index) | ");
printf(" ============================================================ ");
printf(" | %5f| %8f | %10f| ",Weight,Height,BMI);
printf(" ____________________________________________________________ ");
printf(" BMI Value is %f ",BMI);
printf(" You are Normal ");
printf(" ---------THANK YOU---------- ");
}
else if(BMI>=25 && BMI<30)
{
printf(" ============================================================ ");
printf(" | Weight(Pounds) |Height(Inches) | BMI(Body Mass Index) | ");
printf(" ============================================================ ");
printf(" | %5f| %8f | %10f| ",Weight,Height,BMI);
printf(" ____________________________________________________________ ");
printf(" BMI Value is %f. ",BMI);
printf(" You are Over Weight.. ");
printf(" ---------THANK YOU---------- ");
}
else if(BMI>30)
{
printf(" ============================================================ ");
printf(" | Weight(Pounds) |Height(Inches) | BMI(Body Mass Index) | ");
printf(" ============================================================ ");
printf(" | %5f| %8f | %10f| ",Weight,Height,BMI);
printf(" ____________________________________________________________ ");
printf(" BMI Value is %f ",BMI);
printf(" You are Obese ");
printf(" ---------THANK YOU---------- ");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.