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

حل السؤال

حل السؤال 9

import 'dart:io';
void main() {
  stdout.write("Enter the radius (cm): ");
  double radius = double.parse(stdin.readLineSync()!);
  stdout.write("Enter the central angle(degrees): ");
  double angle = double.parse(stdin.readLineSync()!);
  const double pi = 3.1419;
  if (!radius.isFinite || radius <= 0 || !angle.isFinite || angle < 0 || angle > 360) {
    print('Invalid input: radius > 0 and angle from 0 to 360 required.');
    return;
  }
  double area = (pi * radius * radius * angle) / 360;
  print("The area scanned by the angle is ${area.toStringAsFixed(2)} cm^2.");
}
العودة إلى السؤال نفسه