Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Create find_maximum_of_n_numbers.dart (#5714)
Browse files Browse the repository at this point in the history
A program to calculate maximum number in n numbers.
  • Loading branch information
khizer-flow authored May 28, 2024
1 parent 0352fff commit cd6bf84
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<int> 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');
}

0 comments on commit cd6bf84

Please sign in to comment.