Test hinzugefügt
This commit is contained in:
commit
40a6ab6263
34
Test
Normal file
34
Test
Normal file
@ -0,0 +1,34 @@
|
||||
void main() {
|
||||
print('Hello, World!');
|
||||
}
|
||||
|
||||
|
||||
int factorial(int n) {
|
||||
if (n == 0 || n == 1) {
|
||||
return 1;
|
||||
} else {
|
||||
return n * factorial(n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
int number = 5;
|
||||
int result = factorial(number);
|
||||
print('The factorial of $number is $result.');
|
||||
}
|
||||
|
||||
int findMax(List<int> numbers) {
|
||||
int max = numbers[0];
|
||||
for (int i = 1; i < numbers.length; i++) {
|
||||
if (numbers[i] > max) {
|
||||
max = numbers[i];
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
void main() {
|
||||
List<int> numbers = [12, 56, 3, 78, 42, 9];
|
||||
int maxNumber = findMax(numbers);
|
||||
print('The maximum number in the list is $maxNumber.');
|
||||
}
|
Loading…
Reference in New Issue
Block a user