حل السؤال
حل السؤال 41
import 'dart:io';
void main() {
stdout.write("Enter the product price (\$): ");
double price = double.parse(stdin.readLineSync()!);
if (!price.isFinite || price < 0) {
print('Invalid input: a finite nonnegative price required.');
return;
}
double discount = 0.0;
if (price >= 50 && price < 100) {
discount = 0.10;
} else if (price >= 100 && price < 500) {
discount = 0.15;
} else if (price >= 500) {
discount = 0.25;
}
double disPrice = price - (price * discount);
print("Discounted selling price of the product = ${disPrice.toStringAsFixed(2)} \$");
}

