- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C program to Calculate Body Mass Index (BMI)
Given with the weight and height of a person and the task is to find the BMI i.e. body mass index of his body and display it.
For calculating the body mass index we require two things −
- Weight
- Height
BMI can be calculated using the formula given below −
BMI = (mass or weight) / (height*height)
Where weight is in kg and height is in meters
Example
Input 1-: weight = 60.00 Height = 5.1 Output -: BMI index is : 23.53 Input 2-: weight = 54.00 Height = 5.4 Output -: BMI index is : 9.3
Approach used below is as follows −
- Input weight(kg) and height(meter) in float variables
- Apply the formula to compute the body mass index
- Print the BMI
Algorithm
Start Step 1-> Declare function to calculate BMI float BMI(float weight, float height) return weight/height*2 step 2-> In main() Set float weight=60.00 Set float height=5.1 Set float bmi = BMI(weight,height) Print BMI Stop
Example
#include<stdio.h> //function to calculate BMI index float BMI(float weight, float height) { return weight/height*2; } int main() { float weight=60.00; float height=5.1; float bmi = BMI(weight,height); printf("BMI index is : %.2f ",bmi); return 0; }
Output
IF WE RUN THE ABOVE CODE IT WILL GENERATE FOLLOWING OUTPUT
BMI index is : 23.53
- Related Articles
- Java program to calculate Body Mass Index (BMI)
- Python program to calculate BMI(Body Mass Index) of your Body
- A body of mass 25 kg has a momentum of 125 kg.m/s. Calculate the velocity of the body.
- C program to calculate age
- C++ Program to Calculate Standard Deviation
- C++ Program to calculate Double Integration
- C++ Program to Calculate Power Using Recursion
- C++ program to calculate Profit Or Loss
- Write C program to calculate balance instalment
- C program to calculate the standard deviation
- Calculate the kinetic energy of a body of mass $2 kg$ moving with a velocity of $0.1 ms^{-1}$.
- Program to calculate the value of nPr in C Program
- When a force of $40 N$ is applied on a body it moves with an acceleration of $5 ms^{-2}$. Calculate the mass of the body.
- (a) Define mass of a body. What is the SI unit of mass?(b) Define weight of a body. What is the SI unit of weight?(c) What is the relation between mass and weight of a body?
- C++ Program to Calculate Sum of Natural Numbers

Advertisements