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

حل السؤال

حل السؤال 56

import 'dart:io';
void main() {
  stdout.write("Enter the value: ");
  String input = stdin.readLineSync()!;
  int? intValue = int.tryParse(input);
  double? doubleValue = double.tryParse(input);
  if (intValue is int ) {
    print(intValue.toRadixString(2));
  } else if (doubleValue is double) {
    if (!doubleValue.isFinite) {
      print("Non-finite numeric values cannot be rounded.");
      return;
    }
    print(doubleValue.round());
  }else if(input is String){
    print(input.toUpperCase());
  } else
    print("Unsupported input type");
  }
العودة إلى السؤال نفسه