33 lines
535 B
C
33 lines
535 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
#include<string.h>
|
||
|
|
||
|
int main(int argc, char * argv[]) {
|
||
|
if (argc < 3) {
|
||
|
puts("Veuillez renseigner deux valeurs ou plus.");
|
||
|
return EXIT_FAILURE;
|
||
|
}
|
||
|
|
||
|
double* list = (double*) calloc(argc-1, sizeof(double));
|
||
|
|
||
|
for (int i = 0; i < argc-1; i++) {
|
||
|
double val = strtod(argv[i+1], NULL);
|
||
|
int found = 0;
|
||
|
|
||
|
for (int j = 0; j < i; j++) {
|
||
|
if (list[j] == val) found = 1;
|
||
|
}
|
||
|
|
||
|
if (!found) {
|
||
|
list[i] = val;
|
||
|
printf("%.2f ", val);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
free(list);
|
||
|
printf("\n");
|
||
|
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|