Discuss / Java / 可以吗

可以吗

Topic source

赵世俊1990

#1 Created at ... [Delete] [Delete and Lock User]

import java.util.Scanner;

public class Main {

 public static void main(String[] args) {

  Scanner scanner = new Scanner(System.in);

  System.out.println("Input your weigt(Kg):");

  float f1 = scanner.nextFloat();

  System.out.println("Input your heigt(m):");

  float f2 = scanner.nextFloat();

  float f3 = f1 / f2 / f2 ;

  if (f3 < 18.5) {

   System.out.printf("your IBM is %.2f,过轻", f3);

  } else if (f3 <= 25){

   System.out.printf("your IBM is %.2f,正常", f3);

  } else if (f3 <= 28 ) {

   System.out.printf("your IBM is %.2f,过重", f3);

  } else if (f3 <= 32 ) {

   System.out.printf("your IBM is %.2f,肥胖", f3);

  } else {

   System.out.printf("your IBM is %.2f,非常肥胖", f3);

  }

 }

}


  • 1

Reply