java - Why is nothing happening when I run my program? -


when execute program console empty. have no idea causing happen. not receiving error messages except "scanner not closed" warning. causing issue?

public class bmiprogram {  public static void main(string[] args) {      double bmi;     double weight;     double height;      scanner bodymassscan = new scanner(system.in);      weight = bodymassscan.nextint();     height = bodymassscan.nextint();      system.out.println("enter weight in pounds: ");     system.out.println("enter height in inches: ");      bmi = ((weight/math.pow(height, 2)) * 703);      system.out.println(bmi + " bmi");  } 

}

just rearrange code! scanner waiting make 2 inputs before printing out statements.

public class bmiprogram {    public static void main(string[] args) {      double bmi;     double weight;     double height;      scanner bodymassscan = new scanner(system.in);      system.out.println("enter weight in pounds: ");     weight = bodymassscan.nextint();      system.out.println("enter height in inches: ");     height = bodymassscan.nextint();      bmi = ((weight/math.pow(height, 2)) * 703);      system.out.println(bmi + " bmi");      } } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -