فهرس الكتباللغة البرمجية دارت

حل السؤال

حل السؤال 19

import 'dart:io';
void main() {
  stdout.write('Enter your weight (kg): ');
  double weight = double.parse(stdin.readLineSync ()!);
  stdout.write('Enter your height (m): ');
  double height = double.parse(stdin.readLineSync ()!);
  if (!weight.isFinite || weight <= 0 || !height.isFinite || height <= 0) {
    print('Invalid input: finite positive weight and height required.');
    return;
  }
  double bmi = weight / (height * height);
  print('Your Body Mass Index (BMI) = ${bmi.toStringAsFixed(6)}');
  if (bmi < 18.5) {
    print('Educational category: below 18.5.');
  } else if (bmi >= 18.5 && bmi <= 24.9) {
    print('Educational category: from 18.5 to 24.9.');
  } else {
    print('Educational category: above 24.9.');
  }
}
العودة إلى السؤال نفسه