Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. import java.util.*;
  2. public class BMI {
  3.  
  4.     public static void main(String[] args) {
  5.     Scanner sss = new Scanner (System.in);
  6.    
  7.     System.out.println("Enter weight in pounds: ");
  8.     System.out.println("Enter height in inches: ");
  9.    
  10.     double a1;
  11.     a1 = sss.nextDouble();
  12.    
  13.     int a2;
  14.     a2 = sss.nextInt();
  15.    
  16.     double k = (a1*0.45359237);     /* weight in kilograms*/
  17.    
  18.     double m = (a2*0.0254);        /* height in meters*/
  19.    
  20.     double h = (m*m);             /* square height   */
  21.    
  22.     System.out.println("BMI is "+ (double) k/h);
  23.    
  24.            
  25.    
  26.    
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement