Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double bmi;
- double weight;
- double height;
- double powHeight;
- System.out.println("Enter your weight (in pounds)");
- weight = scanner.nextDouble();
- System.out.println("Enter your height (in inches)");
- height = scanner.nextDouble();
- powHeight = Math.pow(height, 2.0);
- bmi = weight * 703 / powHeight;
- System.out.println(bmi);
- if (bmi > 25)
- {
- System.out.println("You're overweight");
- }
- else if (bmi >= 18.5)
- {
- System.out.println("You're optimal");
- }
- else
- {
- System.out.println("You're underweight");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment