Return to Snippet

Revision: 55407
at February 5, 2012 21:55 by oslinux23


Updated Code
//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 2
main(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;
}

Revision: 55406
at February 5, 2012 21:53 by oslinux23


Updated Code
//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 2
main(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;
}

Revision: 55405
at February 5, 2012 21:48 by oslinux23


Updated Code
//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 2
main(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) Height cannot be zero
	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;
}

Revision: 55404
at February 5, 2012 21:29 by oslinux23


Initial Code
//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 2
main(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);
	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;
}

Initial URL
bmi

Initial Description
Body Mass Index Solver

Initial Title
Body Mass Index Solver

Initial Tags
body

Initial Language
C