Ajout un fichier de test

This commit is contained in:
Paul Faure 2021-05-27 12:36:16 +02:00
parent 55e3912171
commit 103916875f

44
max.c Normal file
View file

@ -0,0 +1,44 @@
int get_value() {
int i = 0;
while (i<5) {
printf(0);
stop(1);
printf(255);
stop(1);
i = i+1;
}
stop(15);
i = get();
return i;
}
int max(int * tab, int size) {
int i = 0;
int max = 0;
while (i<size) {
if (tab[i] > max) {
max = tab[i];
}
i = i+1;
}
return max;
}
int main() {
int tab[10];
int i = 0;
while (i<10) {
tab[i] = get_value();
i = i+1;
}
i = 0;
while (i<5) {
printf(170);
stop(1);
printf(85);
stop(1);
i = i+1;
}
stop(3);
printf(max(tab, 10));
}