Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- double easyRound(double dbl, short places)
- {
- return roundf(dbl * pow(10, places)) / pow(10, places);
- }
- int main()
- {
- double w;
- double h;
- std::cout << "please enter your weight in kg: ";
- std::cin >> w;
- std::cout << "\nplease enter your height in meters: ";
- std::cin >> h;
- double bmi = w / (h * h);
- std::cout << "BMI is: " << easyRound(bmi, 3) << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement