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

حل السؤال

حل السؤال 5

import 'dart:io';
void main() {
  stdout.write("Enter the height (cm): ");
  double height = double.parse(stdin.readLineSync()!);
  stdout.write("Enter the diameter (cm): ");
  double diameter = double.parse(stdin.readLineSync()!);
  if (!height.isFinite || height <= 0 || !diameter.isFinite || diameter <= 0) {
    print('Invalid input: finite positive dimensions required.');
    return;
  }
  double radius = diameter / 2;
  const double pi = 3.1419;
  double baseArea = pi * (radius * radius);
  double volume = (1 / 3) * baseArea * height;
  print("Volume of the circular cone: ${volume.toStringAsFixed(2)} cubic cm.");
}
العودة إلى السؤال نفسه