Skip to content

Instantly share code, notes, and snippets.

@TuAnhTo
Created February 27, 2019 04:07
Show Gist options
  • Save TuAnhTo/576421d01f8907ba13a29a2c4e3e1d21 to your computer and use it in GitHub Desktop.
Save TuAnhTo/576421d01f8907ba13a29a2c4e3e1d21 to your computer and use it in GitHub Desktop.
package session1.ChiSoCanNang;
import java.util.Scanner;
public class BMI {
public static void main(String[] args) {
Scanner nhap = new Scanner(System.in);
double weight, heght,bmi;
System.out.println(" nhap vao so can nang kg");
weight = nhap.nextDouble();
System.out.println(" nhap vao chieu cao");
heght = nhap.nextDouble();
bmi = weight / Math.pow(heght,2);
if ( bmi < 18){
System.out.println(" chi so bmi" + bmi + "can nang thieu");
} else if ( bmi < 25){
System.out.println("chi so bmi" + bmi + " can nang binh thuong");
} else if ( bmi < 30){
System.out.println("chi so bmi" + bmi + " thua can");
} else {
System.out.println(" ban da bi map roi");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment