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

حل السؤال

حل السؤال 20

import 'dart:io';
void main () {
  stdout.write('Enter the radius of the circle: ');
  double r = double. parse (stdin. readLineSync ()!);
  if (!r.isFinite || r <= 0) {
    print('Invalid input: a finite positive radius required.');
    return;
  }
  double area = 3.14 * r * r;
  double circumference = 2 * 3.14 * r;
  print('The area of the circle: ${area.toStringAsFixed(6)}');
  print('The circumference of the circle: ${circumference.toStringAsFixed(6)}');
  if (area > circumference) {
    print('The area of the circle is greater than its circumference.');
  } else if (area < circumference) {
      print('The area of the circle is less than its circumference.');
  } else {
    print('The area of the circle is equal to its circumference.');
  }
}
العودة إلى السؤال نفسه