moitié tp 3
This commit is contained in:
24
DEV1.1/TP27/culmination.c
Normal file
24
DEV1.1/TP27/culmination.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*la variable grand lors du début du programme est la première valeur du tableau
|
||||
et le tableau ne contient pas son premier élément*/
|
||||
int superieur(long int tab[], int taille, long int grand){
|
||||
if (taille < 1)
|
||||
return grand;
|
||||
else if (tab[0] > grand)
|
||||
grand = tab[0];
|
||||
return superieur( tab[]+1, taille-1, grand);
|
||||
|
||||
int main(int argc, char** argv){
|
||||
long int val;
|
||||
int i;
|
||||
log int tab[argc];
|
||||
for (i = 1; i < argc; i++){
|
||||
val = strtol(argv[i]);
|
||||
tab[i-1] = val;
|
||||
}
|
||||
val = superieur( tab[]+1, argc-1, tab[0]);
|
||||
printf("%ld\n",val);
|
||||
return EXIT_SUCCESS;
|
||||
Reference in New Issue
Block a user