به‌دست آوردن bmi در جاوا

برنامه ای که bmi یا همان Body Mass Index را محاسبه کند.

//Calculate BMI(Body Mass Index)
/*
 You can calculate your BMI by dividing your weight in pounds by your height in inches squared,
 then multiplying the result by the number 703
 */
//Java Programming
//By: Sina Moradi
//Website: Samiantec.ir
 
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.println("Please enter weight(pound):");
		int weight=input.nextInt();
		System.out.println("Please enter height(inch):");
		int height=input.nextInt();
		System.out.println("BMI is "+bmi(weight,height));
	}
	
	public static double bmi(int weight,int height) {
		return (double)weight*703/(height*height);
	}
}

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد.




Enter Captcha Here :