Created
March 22, 2022 13:40
-
-
Save thomasw-mitutoyo-ctl/f031adea08afe8c848cc6cc9a885c9a0 to your computer and use it in GitHub Desktop.
Schreibe eine Funktion, die aus einer Liste mit Zahlen die kleinste heraussucht.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var liste = [1,5,9,1,0,-5,9]; | |
print(minimum(liste)); | |
} | |
int minimum(List zahlen) | |
{ | |
int min = zahlen[0]; | |
for (int zahl in zahlen) | |
{ | |
if (zahl < min) | |
{ | |
min = zahl; | |
} | |
} | |
return min; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment