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

حل السؤال

حل السؤال 40

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()!);
  int result;
  if (a.isOdd && b.isOdd) {
    result = a + b;
    print("Result (a + b ) = : $result");
  } else if (a.isEven && b.isEven) {
    result = a - b;
    print("Result (a - b ) = : $result");
  } else if (a.isOdd && b.isEven) {
    result = b * a;
    print("Result (a * b ) = : $result");
  } else if (a.isEven && b.isOdd) {
    result = a ~/ b;
    print("Result (a ~/ b ) = : $result");
  }
}
العودة إلى السؤال نفسه