Developpement/23DEV1.1/CM3/Culmination.c

97 lines
1.5 KiB
C
Raw Normal View History

2024-12-09 11:53:11 +01:00
#include <stdio.h>
#include <stdlib.h>
int comparatif(int tab[], int n, int argc, int max){
int val = max;
if(val < tab[n]){
val = tab[n];
}
if(n != argc){
comparatif(tab[], n+1, argc, val);
}else{
return val;
}
}
int main(int argc, char const *argv[])
{
int tab[7];
int max = 0, n = 1;
if(argc<2){
printf("Retournez plus de valeur!");
return EXIT_FAILURE;
}else{
if(n != argc){
tab[n] = argv[n];
n++;
if(n != argc){
tab[n] = argv[n];
n++;
if(n != argc){
tab[n] = argv[n];
n++;
if(n != argc){
tab[n] = argv[n];
n++;
if(n != argc){
tab[n] = argv[n];
n++;
if(n != argc){
tab[n] = argv[n];
n++;
if(n != argc){
tab[n] = argv[n];
n++;
}
}
}
}
}
}
}
n = 0;
if(tab[n] != '\0'){
if(max<tab[n]){
max = tab[n];
}
n++;
if(tab[n] != '\0'){
if(max<tab[n]){
max = tab[n];
}
n++;
if(tab[n] != '\0'){
if(max<tab[n]){
max = tab[n];
}
n++;
if(tab[n] != '\0'){
if(max<tab[n]){
max = tab[n];
}
n++;
if(tab[n] != '\0'){
if(max<tab[n]){
max = tab[n];
}
n++;
if(tab[n] != '\0'){
if(max<tab[n]){
max = tab[n];
}
n++;
if(tab[n] != '\0'){
if(max<tab[n]){
max = tab[n];
}
}
}
}
}
}
}
}
}
printf("%d", max);
return EXIT_SUCCESS;
}