Following is the program to check your BMI :-
#include <stdio.h>
#include<conio.h>
int main()
{
float w, h, bmi;
printf("Enter your weight(in kgs):");
scanf("%f", &w);
printf("Enter your height(in meters):");
scanf("%f", &h);
bmi = (w)/(h * h);
printf("Your Body Mass Index: %f\n", bmi);
return 0;
}
Output:-
Note- using the same logic we can design this program in C++ too
#include <stdio.h>
#include<conio.h>
int main()
{
float w, h, bmi;
printf("Enter your weight(in kgs):");
scanf("%f", &w);
printf("Enter your height(in meters):");
scanf("%f", &h);
bmi = (w)/(h * h);
printf("Your Body Mass Index: %f\n", bmi);
return 0;
}
Output:-
Note- using the same logic we can design this program in C++ too
No comments:
Post a Comment