# Posted By

oslinux23 on 02/05/12

# Statistics

Viewed 416 times
Favorited by 0 user(s)

# Body Mass Index Solver

/ Published in: C

Body Mass Index Solver

Copy this code and paste it in your HTML
`//Icd Dpt// This program calculates the Body Mass Index of a human body. It has been written in C.#include<stdlib.h>#include<stdio.h>#include<math.h>#define EXP 2main(void){	float bmi, wei, hei;	system("clear");	printf("*** This program calculates the Body Mass Index of a human body. Height should be entered in meters and weight in kgs *** \n");        printf("\n");        printf("Enter Body Weight \n");	scanf(" \n%f",&wei);        printf("Enter Body Height \n");        scanf("%f",&hei);	if (hei==0) {printf("Height cannot be zero \n"); return 0;}	hei=pow(hei, EXP);	bmi=wei/(hei);	printf("\n\n");	printf("You entered \n");	printf("Height = %.3f \n", hei);        printf("Weight = %.3f \n", wei);	printf("The Body Mass Index = %f \n", bmi);	printf("Press enter to continue... \n");	fflush(stdin);	getchar();	return 0;}`

URL: bmi