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

حل السؤال

حل السؤال 29

import 'dart:io';
void main() {
  stdout.write("Enter the value a: ");
  int a = int.parse(stdin.readLineSync()!);
  stdout.write("Enter the value b: ");
  int b = int.parse(stdin.readLineSync()!);
  stdout.write("Enter the value c: ");
  int c = int.parse(stdin.readLineSync()!);
  if (a == 0) {
    print('Invalid input: a must be nonzero for a quadratic equation.');
    return;
  }
  int delta = b * b - 4 * a * c;
  print("Delta = $delta");
  if (delta > 0) {
    print("The equation has two different real roots!");
  } else if (delta == 0) {
    print("The equation has one real root!");
  } else {
    print("The equation has no real roots!");
  }
}
العودة إلى السؤال نفسه