diff --git a/program/program/find-maximum-of-n-numbers/find_maximum_of_n_numbers.dart b/program/program/find-maximum-of-n-numbers/find_maximum_of_n_numbers.dart new file mode 100644 index 000000000..dd69134fc --- /dev/null +++ b/program/program/find-maximum-of-n-numbers/find_maximum_of_n_numbers.dart @@ -0,0 +1,22 @@ +import 'dart:io'; + +void main() { + stdout.write('Enter the number of numbers you want to check: '); + int? n = int.parse(stdin.readLineSync()!); + List a = []; + + for (int i = 0; i < n; i++) { + stdout.write('Enter the number [${i + 1}]: '); + int number = int.parse(stdin.readLineSync()!); + a.add(number); + } + + int max = a[0]; + for (int i = 0; i < n; i++) { + if (a[i] > max) { + max = a[i]; + } + } + + print('The Max number is: $max'); +}